]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
mprintf: remove strlen calls on empty strings in dprintf_formatf
authorHenrik Holst <henrik.holst@millistream.com>
Thu, 10 Feb 2022 17:47:08 +0000 (18:47 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 11 Feb 2022 22:07:34 +0000 (23:07 +0100)
Turns out that in dprintf_formatf we did a strlen on empty strings, a
bit strange is how common this actually is, 24 alone when doing a simple
GET from https://curl.se

Closes #8427

lib/mprintf.c

index b109379bf2a6771334c55915b7612266c67eb738..13812010b352c7c54c3b7e797a74f782411a6844 100644 (file)
@@ -829,6 +829,8 @@ static int dprintf_formatf(
         }
         else if(prec != -1)
           len = (size_t)prec;
+        else if(*str == '\0')
+          len = 0;
         else
           len = strlen(str);