]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
smtp_parse_address: handle blank input string properly
authorDaniel Stenberg <daniel@haxx.se>
Thu, 6 Aug 2020 22:15:12 +0000 (00:15 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 7 Aug 2020 09:49:36 +0000 (11:49 +0200)
Closes #5792

lib/smtp.c

index 685513b3b1cf6b6819660f3a8e6d2b1be6acb03c..aea41bb4e3f15a6a4ec29ddd8a76cc0d7c25d7f4 100644 (file)
@@ -1760,8 +1760,10 @@ static CURLcode smtp_parse_address(struct connectdata *conn, const char *fqma,
     return CURLE_OUT_OF_MEMORY;
 
   length = strlen(dup);
-  if(dup[length - 1] == '>')
-    dup[length - 1] = '\0';
+  if(length) {
+    if(dup[length - 1] == '>')
+      dup[length - 1] = '\0';
+  }
 
   /* Extract the host name from the address (if we can) */
   host->name = strpbrk(dup, "@");