[PATCH 14/22] autofs-5.1.4 - add NULL check in prepare_attempt_prefix()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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

diff --git a/CHANGELOG b/CHANGELOG
index 0a56df5a..ad9932a2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -43,6 +43,7 @@ xx/xx/2018 autofs-5.1.5
 - better handle hesiod support not built in.
 - fix indent in automount(8) man page.
 - remove autofs4 module load code.
+- add NULL check in prepare_attempt_prefix().
 
 19/12/2017 autofs-5.1.4
 - fix spec file url.
diff --git a/lib/log.c b/lib/log.c
index f6ab77c1..41f95fe8 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -44,6 +44,8 @@ static char *prepare_attempt_prefix(const char *msg)
 
 		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);




[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux