]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
smtp: set auth correctly
authorDaniel Stenberg <daniel@haxx.se>
Fri, 24 Apr 2020 22:22:21 +0000 (00:22 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 25 Apr 2020 12:14:43 +0000 (14:14 +0200)
Regression since 7.69.0 and 68fb25fa3fcff.

The code wrongly assigned 'from' instead of 'auth' which probably was a
copy and paste mistake from other code, leading to that auth could
remain NULL and later cause an error to be returned.

Assisted-by: Eric Sauvageau
Fixes #5294
Closes #5295

lib/smtp.c

index 93e004d201649c5129c11f6407b097fcbe741c25..bf65f246f094bcd83cad563e02d7679fc3fd4bd0 100644 (file)
@@ -625,8 +625,7 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
         utf8 = TRUE;
 
       if(host.name) {
-        free(from);
-        from = aprintf("<%s@%s>", address, host.name);
+        auth = aprintf("<%s@%s>", address, host.name);
 
         Curl_free_idnconverted_hostname(&host);
       }
@@ -636,8 +635,6 @@ 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 */