List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH 1/1] html: fix handling of null byte
@ 2020-11-11 21:19 Christian Hesse
  0 siblings, 0 replies; only message in thread
From: Christian Hesse @ 2020-11-11 21:19 UTC (permalink / raw)
  To: cgit; +Cc: Peter Prohaska, Christian Hesse

From: Peter Prohaska <pitrp@web.de>

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 | 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);
 	}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-11 21:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11 21:19 [PATCH 1/1] html: fix handling of null byte Christian Hesse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).