]> granicus.if.org Git - cgit/commitdiff
html: fix handling of null byte
authorPeter Prohaska <pitrp@web.de>
Wed, 11 Nov 2020 21:16:21 +0000 (22:16 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 19 Dec 2022 15:13:58 +0000 (16:13 +0100)
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>
html.c

diff --git a/html.c b/html.c
index 7f81965fddcd837cc880f3a28b120d9fe71b504c..0bac34bcf82b3a31ad3dda25f7c7bcee3d9d8f3a 100644 (file)
--- 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);
        }