]> granicus.if.org Git - curl/commitdiff
checkpasswd() prevents segfault by checking that input argument is non-NULL
authorDaniel Stenberg <daniel@haxx.se>
Mon, 10 May 2004 09:16:21 +0000 (09:16 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 10 May 2004 09:16:21 +0000 (09:16 +0000)
src/main.c

index a11f0277cfd881d9892a8663c77d813a812963b9..5439253d954cbeca165eebec2993c8c92d7a3b9d 100644 (file)
@@ -1049,7 +1049,11 @@ static int str2offset(curl_off_t *val, char *str)
 static void checkpasswd(const char *kind, /* for what purpose */
                         char **userpwd) /* pointer to allocated string */
 {
-  char *ptr = strchr(*userpwd, ':');
+  char *ptr;
+  if(!*userpwd)
+    return;
+
+  ptr = strchr(*userpwd, ':');
   if(!ptr) {
     /* no password present, prompt for one */
     char passwd[256]="";