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

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