aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Prohaska <pitrp@web.de>2020-11-11 22:16:21 +0100
committerChristian Hesse <mail@eworm.de>2021-05-12 15:36:39 +0200
commitd828a623442e3fc3159e2c188a78e6fd4aca8af4 (patch)
tree705f319d1114db6b190a42326e0f004135c0203e
parenttests: t0107: support older and/or non-GNU tar (diff)
downloadcgit-ch/html-fmt.tar.xz
cgit-ch/html-fmt.zip
html: fix handling of null bytech/html-fmt
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);
}