]> granicus.if.org Git - curl/commitdiff
smtp: fix compiler warning
authorRikard Falkeborn <rikard.falkeborn@gmail.com>
Thu, 4 Apr 2019 21:13:56 +0000 (23:13 +0200)
committerJay Satiro <raysatiro@yahoo.com>
Fri, 5 Apr 2019 01:11:42 +0000 (21:11 -0400)
- Fix clang string-plus-int warning.

Clang 8 warns about adding a string to an int does not append to the
string. Indeed it doesn't, but that was not the intention either. Use
array indexing as suggested to silence the warning. There should be no
functional changes.

(In other words clang warns about "foo"+2 but not &"foo"[2] so use the
latter.)

smtp.c:1221:29: warning: adding 'int' to a string does not append to the
string [-Wstring-plus-int]
      eob = strdup(SMTP_EOB + 2);
            ~~~~~~~~~~~~~~~~^~~~

Closes https://github.com/curl/curl/pull/3729

lib/smtp.c

index f3db714b5a3defec77092b0b722e3196f3ec9e74..fec0026a24ccc764801874ae839a56fe90ace6ae 100644 (file)
@@ -1218,7 +1218,7 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
        returned CURLE_AGAIN, we duplicate the EOB now rather than when the
        bytes written doesn't equal len. */
     if(smtp->trailing_crlf || !conn->data->state.infilesize) {
-      eob = strdup(SMTP_EOB + 2);
+      eob = strdup(&SMTP_EOB[2]);
       len = SMTP_EOB_LEN - 2;
     }
     else {