autofs-5.1.0 - check host macro is set before use
From: Ian Kent <ikent@redhat.com>
Check marco lookup return for ${host} in match_my_name() before using it.
---
CHANGELOG | 1 +
modules/parse_amd.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/CHANGELOG b/CHANGELOG
index d7d161f..20290fc 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -15,6 +15,7 @@
- fix buffer size checks in merge_options().
- check amd lex buffer len before copy.
- add return check in ldap check_map_indirect().
+- check host macro is set before use.
04/06/2014 autofs-5.1.0
=======================
diff --git a/modules/parse_amd.c b/modules/parse_amd.c
index 26d01ed..25fe4aa 100644
--- a/modules/parse_amd.c
+++ b/modules/parse_amd.c
@@ -238,6 +238,11 @@ static int match_my_name(unsigned int logopt, const char *name, struct substvar
return 1;
}
+ if (!v || !v->val) {
+ error(logopt, "error: ${host} not set");
+ goto out;
+ }
+
/* Check if comparison value is an alias */
memset(&hints, 0, sizeof(hints));