summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-08-07 00:15:12 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-08-07 11:49:36 +0200
commit265717d27117a722b2b3ccc5f38de722c3a79070 (patch)
tree0dde45a4479cb276deab13bb85528cc31feac2a9
parent82ed83ae30c2bf7110792b861a93d76bfa2bbd89 (diff)
downloadcurl-265717d27117a722b2b3ccc5f38de722c3a79070.tar.gz
smtp_parse_address: handle blank input string properly
Closes #5792
-rw-r--r--lib/smtp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/smtp.c b/lib/smtp.c
index 685513b3b..aea41bb4e 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -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, "@");