aboutsummaryrefslogtreecommitdiffstats
path: root/html.c
diff options
context:
space:
mode:
authorPeter Prohaska2020-11-11 22:16:21 +0100
committerYigit Sever2023-07-21 03:03:50 +0300
commit9701f8e61129865cad35483eb4b6271ba048d0ad (patch)
tree466fdee444b1ed2a777fd1f4b573e352f350c0b2 /html.c
parentde3ddb966cf47bd6a3cc39a00d1926da33b03c50 (diff)
downloadcgit-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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/html.c b/html.c
index 7f81965..0bac34b 100644
--- a/html.c
+++ b/html.c
@@ -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 }