Blob Blame History Raw
autofs-5.1.4 - add NULL check in prepare_attempt_prefix()

From: Ian Kent <raven@themaw.net>

prepare_attempt_prefix() calls calloc(3) and continues without
checking if the allocation succeeded.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG |    1 +
 lib/log.c |    2 ++
 2 files changed, 3 insertions(+)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -311,6 +311,7 @@
 - add master map pseudo options for mount propagation.
 - fix amd parser opts option handling.
 - fix incorrect locking in sss lookup.
+- add NULL check in prepare_attempt_prefix().
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/lib/log.c
+++ autofs-5.0.7/lib/log.c
@@ -44,6 +44,8 @@ static char *prepare_attempt_prefix(cons
 
 		snprintf(buffer, ATTEMPT_ID_SIZE, "%02lx", *attempt_id);
 		prefixed_msg = (char *) calloc(len, sizeof(char));
+		if (!prefixed_msg)
+			return NULL;
 		strcpy(prefixed_msg, buffer);
 		strcat(prefixed_msg, "|");
 		strcat(prefixed_msg, msg);