summaryrefslogtreecommitdiff
path: root/lib/sendf.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-07-07 14:51:17 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-07-08 10:05:39 +0200
commit9053dbbf62c7c9f4723959b557078a787ba6afec (patch)
treea6f859428ac17f47bd89e2dd72b5b11220525699 /lib/sendf.c
parente7416cfd2bd58d256b8524f31ef22a43aa23a970 (diff)
downloadcurl-9053dbbf62c7c9f4723959b557078a787ba6afec.tar.gz
msnprintf: return number of printed characters excluding null byte
... even when the output is "capped" by the maximum length argument. Clarified in the docs. Closes #7361
Diffstat (limited to 'lib/sendf.c')
-rw-r--r--lib/sendf.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/sendf.c b/lib/sendf.c
index d56399b77..14ca84bfe 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -246,8 +246,7 @@ void Curl_infof(struct Curl_easy *data, const char *fmt, ...)
size_t len;
char buffer[MAXINFO + 2];
va_start(ap, fmt);
- (void)mvsnprintf(buffer, MAXINFO, fmt, ap);
- len = strlen(buffer);
+ len = mvsnprintf(buffer, MAXINFO, fmt, ap);
va_end(ap);
buffer[len++] = '\n';
buffer[len] = '\0';
@@ -267,8 +266,7 @@ void Curl_failf(struct Curl_easy *data, const char *fmt, ...)
size_t len;
char error[CURL_ERROR_SIZE + 2];
va_start(ap, fmt);
- (void)mvsnprintf(error, CURL_ERROR_SIZE, fmt, ap);
- len = strlen(error);
+ len = mvsnprintf(error, CURL_ERROR_SIZE, fmt, ap);
if(data->set.errorbuffer && !data->state.errorbuf) {
strcpy(data->set.errorbuffer, error);