]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ftp: fix Codacy/cppcheck warning about null pointer arithmetic
authorMarcel Raad <Marcel.Raad@teamviewer.com>
Sat, 6 Feb 2021 09:26:38 +0000 (10:26 +0100)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Wed, 10 Feb 2021 15:46:52 +0000 (16:46 +0100)
Increment `bytes` only if it is non-null.

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

lib/ftp.c

index f0ce14c13d70e5036f68fe00562bf841d04616b5..56e7cf29ef2f576f83455644a7814a5bd08e0a39 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -2482,7 +2482,8 @@ static CURLcode ftp_state_get_resp(struct Curl_easy *data,
           bytes--;
         }
         /* if we have nothing but digits: */
-        if(bytes++) {
+        if(bytes) {
+          ++bytes;
           /* get the number! */
           (void)curlx_strtoofft(bytes, NULL, 0, &size);
         }