From 9701f8e61129865cad35483eb4b6271ba048d0ad Mon Sep 17 00:00:00 2001 From: Peter Prohaska Date: Wed, 11 Nov 2020 22:16:21 +0100 Subject: html: fix handling of null byte A return value of `len` or more means that the output was truncated. Signed-off-by: Peter Prohaska Signed-off-by: Christian Hesse --- html.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } -- cgit v1.2.3-70-g09d2