From: Daniel Stenberg Date: Sat, 31 Mar 2007 21:35:56 +0000 (+0000) Subject: Since the str2num() function gets called with the 'nextarg' pointer from X-Git-Tag: curl-7_16_2~66 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2beee209bc9a65ff4a0eb85feabe60311741899;p=curl Since the str2num() function gets called with the 'nextarg' pointer from within the getparameter a lot, we must check it for NULL before accessing the str data. CID 14 of the coverity.com scan --- diff --git a/src/main.c b/src/main.c index 72f28e3c9..391288708 100644 --- a/src/main.c +++ b/src/main.c @@ -1273,12 +1273,16 @@ static void cleanarg(char *str) * non-zero on failure, zero on success. * * The string must start with a digit to be valid. + * + * Since this function gets called with the 'nextarg' pointer from within the + * getparameter a lot, we must check it for NULL before accessing the str + * data. */ static int str2num(long *val, char *str) { int retcode = 0; - if(ISDIGIT(*str)) + if(str && ISDIGIT(*str)) *val = atoi(str); else retcode = 1; /* badness */