diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-02-28 09:49:02 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-02-28 09:49:02 +0100 |
commit | 3c0eb93339a99325dce70152c3b0fb23ff391b7f (patch) | |
tree | 6cebdaa2d9908ae9b197eb8a9c0731c4203633d8 | |
parent | 1f114be62621ba756d7c0f8c96eb35505a4a020b (diff) | |
download | curl-bagder/smtp-coverity.tar.gz |
smtp: overwriting 'from' leaks memorybagder/smtp-coverity
Detected by Coverity. CID 1418139.
Also, make sure to return error if the new 'from' allocation fails.
-rw-r--r-- | lib/smtp.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/smtp.c b/lib/smtp.c index 77fcd5afc..e1872871d 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -625,6 +625,7 @@ static CURLcode smtp_perform_mail(struct connectdata *conn) utf8 = TRUE; if(host.name) { + free(from); from = aprintf("<%s@%s>", address, host.name); Curl_free_idnconverted_hostname(&host); @@ -635,6 +636,8 @@ static CURLcode smtp_perform_mail(struct connectdata *conn) auth = aprintf("<%s>", address); free(address); + if(!from) + return CURLE_OUT_OF_MEMORY; } else /* Empty AUTH, RFC-2554, sect. 5 */ |