From 0e48ac1f99a370a8b378e8ca059525feb0bf74d3 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 13 Jul 2022 23:46:16 +0200 Subject: mprintf: make dprintf_formatf never return negative This function no longer returns a negative value if the formatting string is bad since the return value would sometimes be propagated as a return code from the mprintf* functions and they are documented to return the length of the output. Which cannot be negative. Fixes #9149 Closes #9151 Reported-by: yiyuaner on github --- lib/sendf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/sendf.c') diff --git a/lib/sendf.c b/lib/sendf.c index a21028457..32714255d 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -245,7 +245,7 @@ void Curl_infof(struct Curl_easy *data, const char *fmt, ...) DEBUGASSERT(!strchr(fmt, '\n')); if(data && data->set.verbose) { va_list ap; - size_t len; + int len; char buffer[MAXINFO + 2]; va_start(ap, fmt); len = mvsnprintf(buffer, MAXINFO, fmt, ap); @@ -265,7 +265,7 @@ void Curl_failf(struct Curl_easy *data, const char *fmt, ...) DEBUGASSERT(!strchr(fmt, '\n')); if(data->set.verbose || data->set.errorbuffer) { va_list ap; - size_t len; + int len; char error[CURL_ERROR_SIZE + 2]; va_start(ap, fmt); len = mvsnprintf(error, CURL_ERROR_SIZE, fmt, ap); -- cgit v1.2.1