autofs-5.1.7 - fix use of possibly NULL var in lookup_program.c:match_key() From: Ian Kent The lookup key used in match_key() should not be NULL. A check for a malloc() failure of the lookup key is missing in one of the two cases in match_key() so add it. Signed-off-by: Ian Kent --- CHANGELOG | 1 + modules/lookup_program.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 61f3547a..680dbbd7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -81,6 +81,7 @@ - fix concat_options() error handling. - eliminate some more alloca usage. - use default stack size for threads. +- fix use of possibly NULL var in lookup_program.c:match_key(). 25/01/2021 autofs-5.1.7 - make bind mounts propagation slave by default. diff --git a/modules/lookup_program.c b/modules/lookup_program.c index 028580e5..691abedb 100644 --- a/modules/lookup_program.c +++ b/modules/lookup_program.c @@ -468,6 +468,11 @@ static int match_key(struct autofs_point *ap, if (!is_amd_format) { lkp_key = strdup(name); + if (!lkp_key) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + error(ap->logopt, MODPREFIX "malloc: %s", estr); + return NSS_STATUS_UNAVAIL; + } lkp_len = name_len; } else { size_t len;