diff options
author | Peter Prohaska | 2020-11-11 22:16:21 +0100 |
---|---|---|
committer | Yigit Sever | 2023-07-21 03:03:50 +0300 |
commit | 9701f8e61129865cad35483eb4b6271ba048d0ad (patch) | |
tree | 466fdee444b1ed2a777fd1f4b573e352f350c0b2 /html.c | |
parent | de3ddb966cf47bd6a3cc39a00d1926da33b03c50 (diff) | |
download | cgit-9701f8e61129865cad35483eb4b6271ba048d0ad.tar.gz cgit-9701f8e61129865cad35483eb4b6271ba048d0ad.tar.bz2 cgit-9701f8e61129865cad35483eb4b6271ba048d0ad.zip |
html: fix handling of null byte
A return value of `len` or more means that the output was truncated.
Signed-off-by: Peter Prohaska <pitrp@web.de>
Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'html.c')
-rw-r--r-- | html.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -59,7 +59,7 @@ char *fmt(const char *format, ...) | |||
59 | va_start(args, format); | 59 | va_start(args, format); |
60 | len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args); | 60 | len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args); |
61 | va_end(args); | 61 | va_end(args); |
62 | if (len > sizeof(buf[bufidx])) { | 62 | if (len >= sizeof(buf[bufidx])) { |
63 | fprintf(stderr, "[html.c] string truncated: %s\n", format); | 63 | fprintf(stderr, "[html.c] string truncated: %s\n", format); |
64 | exit(1); | 64 | exit(1); |
65 | } | 65 | } |