From 186340c9cd02ae383bc6b39c353ad5317d4ee574 Mon Sep 17 00:00:00 2001 From: Henrik Holst Date: Thu, 10 Feb 2022 18:47:08 +0100 Subject: [PATCH] mprintf: remove strlen calls on empty strings in dprintf_formatf 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/mprintf.c b/lib/mprintf.c index b109379bf2..13812010b3 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -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);