[Chilli] [PATCH] Fix: Null termination of the excev argument

Masashi Honma honma at ictec.co.jp
Fri Feb 26 02:21:52 UTC 2010


Hello.

I am new to this list.

This patch null terminate the excev argument when reload flag is true.
And check the return value of calloc.


Index: options.c
===================================================================
--- options.c	(revision 292)
+++ options.c	(working copy)
@@ -134,6 +134,10 @@
   }
 
   newargs = calloc(1, sizeof(char *) * (argc + 4));
+  if (newargs == NULL) {
+    log_err(errno, "calloc() failed!");
+    return -1;
+  }
 
   for (i=1; i < argc; i++) {
     newargs[i] = argv[i];
@@ -143,6 +147,7 @@
   newargs[i++] = "-b";
   newargs[i++] = file;
   newargs[i++] = reload ? "-r" : NULL;
+  newargs[i++] = NULL;
 
   log_dbg("running chilli_opt on %s", file);
 

Regards,
Masashi Honma.


More information about the Chilli mailing list