From 00557a5475483078c8d08c496dfc08f3efdfdfc5 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 10 May 2004 09:16:21 +0000
Subject: [PATCH] checkpasswd() prevents segfault by checking that input
 argument is non-NULL

---
 src/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main.c b/src/main.c
index a11f0277cf..5439253d95 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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]="";
-- 
GitLab