Skip to content

Commit ce2062d

Browse files
pitrpzx2c4
authored andcommitted
html: fix handling of null byte
A return value of `len` or more means that the output was truncated. Signed-off-by: Peter Prohaska <[email protected]> Signed-off-by: Christian Hesse <[email protected]>
1 parent 4e4b30e commit ce2062d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

html.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ char *fmt(const char *format, ...)
5959
va_start(args, format);
6060
len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args);
6161
va_end(args);
62-
if (len > sizeof(buf[bufidx])) {
62+
if (len >= sizeof(buf[bufidx])) {
6363
fprintf(stderr, "[html.c] string truncated: %s\n", format);
6464
exit(1);
6565
}

0 commit comments

Comments
 (0)