summaryrefslogtreecommitdiff
path: root/lib/sendf.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2022-07-13 23:46:16 +0200
committerDaniel Stenberg <daniel@haxx.se>2022-07-17 23:27:02 +0200
commit0e48ac1f99a370a8b378e8ca059525feb0bf74d3 (patch)
tree3e0bd2caacc4dee994879eddc64534cc70652c76 /lib/sendf.c
parent8d06af10fb843476988110832e787fa918491109 (diff)
downloadcurl-0e48ac1f99a370a8b378e8ca059525feb0bf74d3.tar.gz
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
Diffstat (limited to 'lib/sendf.c')
-rw-r--r--lib/sendf.c4
1 files changed, 2 insertions, 2 deletions
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);