aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Prohaska <pitrp@web.de>2020-11-11 22:16:21 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2022-12-19 16:13:58 +0100
commitce2062d9e29bf165ba8a70bfc92ff3ab08338d53 (patch)
tree9d6243e7adf8abd93ab4b8ce8fbc84233c242ef7
parent4e4b30effb773e8cb0c9c23fd664a11bbe5b4076 (diff)
downloadcgit-ce2062d9e29bf165ba8a70bfc92ff3ab08338d53.tar.gz
cgit-ce2062d9e29bf165ba8a70bfc92ff3ab08338d53.tar.bz2
cgit-ce2062d9e29bf165ba8a70bfc92ff3ab08338d53.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>
-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, ...)
va_start(args, format);
len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args);
va_end(args);
- if (len > sizeof(buf[bufidx])) {
+ if (len >= sizeof(buf[bufidx])) {
fprintf(stderr, "[html.c] string truncated: %s\n", format);
exit(1);
}