From 2961c7b794c0ea8198f1092eb9a3fc85fd05df4a Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Sat, 17 Apr 2004 16:06:16 +0000 Subject: [PATCH] Patch by Steve Grubb to correct memory calculation --- syslogd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/syslogd.c b/syslogd.c index a3f11f7..e156c1b 100644 --- a/syslogd.c +++ b/syslogd.c @@ -446,6 +446,10 @@ static char sccsid[] = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88"; * so it guaranteed to be available when the child is forked, * hence, fixing a race condition. This used to create problems * with UML and fast machines. + * + * Sat Apr 17 18:03:05 2004: Steve Grubb + * Correct memory allocation for for commandline arguments in + * crunch_list(). */ @@ -1280,7 +1284,7 @@ crunch_list(list) for (count=i=0; p[i]; i++) if (p[i] == LIST_DELIMITER) count++; - if ((result = (char **)malloc(sizeof(char *) * count+2)) == NULL) { + if ((result = (char **)malloc(sizeof(char *) * (count+2))) == NULL) { printf ("Sorry, can't get enough memory, exiting.\n"); exit(0); }