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

306fa1
autofs-5.1.4 - add NULL check in prepare_attempt_prefix()
306fa1
306fa1
From: Ian Kent <raven@themaw.net>
306fa1
306fa1
prepare_attempt_prefix() calls calloc(3) and continues without
306fa1
checking if the allocation succeeded.
306fa1
306fa1
Signed-off-by: Ian Kent <raven@themaw.net>
306fa1
---
306fa1
 CHANGELOG |    1 +
306fa1
 lib/log.c |    2 ++
306fa1
 2 files changed, 3 insertions(+)
306fa1
306fa1
--- autofs-5.0.7.orig/CHANGELOG
306fa1
+++ autofs-5.0.7/CHANGELOG
306fa1
@@ -311,6 +311,7 @@
306fa1
 - add master map pseudo options for mount propagation.
306fa1
 - fix amd parser opts option handling.
306fa1
 - fix incorrect locking in sss lookup.
306fa1
+- add NULL check in prepare_attempt_prefix().
306fa1
 
306fa1
 25/07/2012 autofs-5.0.7
306fa1
 =======================
306fa1
--- autofs-5.0.7.orig/lib/log.c
306fa1
+++ autofs-5.0.7/lib/log.c
306fa1
@@ -44,6 +44,8 @@ static char *prepare_attempt_prefix(cons
306fa1
 
306fa1
 		snprintf(buffer, ATTEMPT_ID_SIZE, "%02lx", *attempt_id);
306fa1
 		prefixed_msg = (char *) calloc(len, sizeof(char));
306fa1
+		if (!prefixed_msg)
306fa1
+			return NULL;
306fa1
 		strcpy(prefixed_msg, buffer);
306fa1
 		strcat(prefixed_msg, "|");
306fa1
 		strcat(prefixed_msg, msg);