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

David Bird david at coova.com
Fri Feb 26 06:26:37 UTC 2010


Thanks, however, calloc will already ensure that newargs is initialized
to zero, so the newargs[i++] = NULL should not be required. 


On Fri, 2010-02-26 at 11:21 +0900, Masashi Honma wrote:
> 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.
> _______________________________________________
> Chilli mailing list
> Chilli at coova.org
> http://lists.coova.org/cgi-bin/mailman/listinfo/chilli




More information about the Chilli mailing list