mirror of
https://git.zx2c4.com/cgit
synced 2025-06-20 17:15:44 +02:00
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>
This commit is contained in:
parent
4e4b30effb
commit
ce2062d9e2
1 changed files with 1 additions and 1 deletions
2
html.c
2
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue