1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-24 00:58:48 -05:00

smtp_parse_address: handle blank input string properly

Closes #5792
This commit is contained in:
Daniel Stenberg 2020-08-07 00:15:12 +02:00
parent 82ed83ae30
commit 265717d271
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

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