From: Daniel Stenberg Date: Thu, 6 Aug 2020 22:15:12 +0000 (+0200) Subject: smtp_parse_address: handle blank input string properly X-Git-Tag: curl-7_72_0~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=265717d27117a722b2b3ccc5f38de722c3a79070;p=thirdparty%2Fcurl.git smtp_parse_address: handle blank input string properly Closes #5792 --- diff --git a/lib/smtp.c b/lib/smtp.c index 685513b3b1..aea41bb4e3 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, "@");