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

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