From: Christian Hesse <list@eworm.de>
To: cgit@lists.zx2c4.com
Cc: Peter Prohaska <pitrp@web.de>, Christian Hesse <mail@eworm.de>
Subject: [PATCH 1/1] html: fix handling of null byte
Date: Wed, 11 Nov 2020 22:19:59 +0100 [thread overview]
Message-ID: <20201111211959.22841-1-list@eworm.de> (raw)
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);
}
reply other threads:[~2020-11-11 21:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201111211959.22841-1-list@eworm.de \
--to=list@eworm.de \
--cc=cgit@lists.zx2c4.com \
--cc=mail@eworm.de \
--cc=pitrp@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).