]> granicus.if.org Git - curl/commitdiff
mime:escape_string minor clarification change
authorDaniel Stenberg <daniel@haxx.se>
Sun, 17 Sep 2017 21:31:49 +0000 (23:31 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 18 Sep 2017 21:15:41 +0000 (23:15 +0200)
... as it also removes a warning with old gcc versions.

Bug: https://curl.haxx.se/mail/lib-2017-09/0049.html
Reported-by: Ben Greear
lib/mime.c

index 9f3d40f1a24d134cc78856a3c9a837a983a77cf1..312094d7f5728641bf028b8aa1db037a990d8205 100644 (file)
@@ -296,9 +296,12 @@ static char *escape_string(const char *src, size_t len)
   for(i = 0; len; len--) {
     char c = *src++;
 
-    if(c == '"' || c == '\\' || !c)
+    if(c == '"' || c == '\\' || !c) {
       dst[i++] = '\\';
-    dst[i++] = c? c: '0';
+      if(!c)
+        c = '0';
+    }
+    dst[i++] = c;
   }
 
   dst[i] = '\0';