aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-03-31 21:35:56 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-03-31 21:35:56 +0000
commitf2beee209bc9a65ff4a0eb85feabe60311741899 (patch)
tree3ec7530d244f76ac417b9af0029b8631dc0672c6 /src
parent9d8b22d3de72d4e38d19e284d7656eea87c688b8 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/main.c6
1 files changed, 5 insertions, 1 deletions
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 */