diff options
author | Curl Upstream <curl-library@cool.haxx.se> | 2021-09-14 07:02:52 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-09-15 19:28:31 (GMT) |
commit | 386467c9dc939cd20711c451dd7d60341fd0e802 (patch) | |
tree | 73d1b75e65ec941fff25153f1a10b88dee1e6c2c /lib/mprintf.c | |
parent | 18b2a8d7604f3aced9c93220806851f96e231f36 (diff) | |
download | CMake-386467c9dc939cd20711c451dd7d60341fd0e802.zip CMake-386467c9dc939cd20711c451dd7d60341fd0e802.tar.gz CMake-386467c9dc939cd20711c451dd7d60341fd0e802.tar.bz2 |
curl 2021-09-14 (8e82f2a0)
Code extracted from:
https://github.com/curl/curl.git
at commit 8e82f2a04a238c54ba91e553e9a8452e6d405965 (curl-7_79_0).
Diffstat (limited to 'lib/mprintf.c')
-rw-r--r-- | lib/mprintf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/mprintf.c b/lib/mprintf.c index 5292026..7a1aec5 100644 --- a/lib/mprintf.c +++ b/lib/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; } |