1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 16:18:48 -05:00

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
This commit is contained in:
Daniel Stenberg 2007-03-31 21:35:56 +00:00
parent 9d8b22d3de
commit f2beee209b

View File

@ -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 */