Blame SOURCES/autofs-5.1.4-add-NULL-check-in-prepare_attempt_prefix.patch

135b98
autofs-5.1.4 - add NULL check in prepare_attempt_prefix()
135b98
135b98
From: Ian Kent <raven@themaw.net>
135b98
135b98
prepare_attempt_prefix() calls calloc(3) and continues without
135b98
checking if the allocation succeeded.
135b98
135b98
Signed-off-by: Ian Kent <raven@themaw.net>
135b98
---
135b98
 CHANGELOG |    1 +
135b98
 lib/log.c |    2 ++
135b98
 2 files changed, 3 insertions(+)
135b98
135b98
--- autofs-5.1.4.orig/CHANGELOG
135b98
+++ autofs-5.1.4/CHANGELOG
135b98
@@ -39,6 +39,7 @@ xx/xx/2018 autofs-5.1.5
135b98
 - better handle hesiod support not built in.
135b98
 - fix hesiod string check in master_parse().
135b98
 - remove autofs4 module load code.
135b98
+- add NULL check in prepare_attempt_prefix().
135b98
 
135b98
 19/12/2017 autofs-5.1.4
135b98
 - fix spec file url.
135b98
--- autofs-5.1.4.orig/lib/log.c
135b98
+++ autofs-5.1.4/lib/log.c
135b98
@@ -44,6 +44,8 @@ static char *prepare_attempt_prefix(cons
135b98
 
135b98
 		snprintf(buffer, ATTEMPT_ID_SIZE, "%02lx", *attempt_id);
135b98
 		prefixed_msg = (char *) calloc(len, sizeof(char));
135b98
+		if (!prefixed_msg)
135b98
+			return NULL;
135b98
 		strcpy(prefixed_msg, buffer);
135b98
 		strcat(prefixed_msg, "|");
135b98
 		strcat(prefixed_msg, msg);