summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/mprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libcurl/src/mprintf.c')
-rw-r--r--libs/libcurl/src/mprintf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/libcurl/src/mprintf.c b/libs/libcurl/src/mprintf.c
index 5292026861..7a1aec570e 100644
--- a/libs/libcurl/src/mprintf.c
+++ b/libs/libcurl/src/mprintf.c
@@ -1017,9 +1017,11 @@ int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format,
retcode = dprintf_formatf(&info, addbyter, format, ap_save);
if((retcode != -1) && info.max) {
/* we terminate this with a zero byte */
- if(info.max == info.length)
+ if(info.max == info.length) {
/* we're at maximum, scrap the last letter */
info.buffer[-1] = 0;
+ retcode--; /* don't count the nul byte */
+ }
else
info.buffer[0] = 0;
}