From 1c08527bd6f225924ba3e2d301239e790dbccb8b Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Wed, 5 Aug 2026 21:54:15 -1000 Subject: Settle the names, types and layout of the sources --- source/html.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/html.c') diff --git a/source/html.c b/source/html.c index 700f033..c3ab696 100644 --- a/source/html.c +++ b/source/html.c @@ -46,7 +46,7 @@ static const char* url_escape_table[256] = { "%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff" }; -char *fmt(const char *format, ...) +char *cgit_fmt(const char *format, ...) { static char buf[8][1024]; static int bufidx; @@ -59,14 +59,14 @@ 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 < 0 || (size_t)len >= sizeof(buf[bufidx])) { fprintf(stderr, "[html.c] string truncated: %s\n", format); exit(1); } return buf[bufidx]; } -char *fmtalloc(const char *format, ...) +char *cgit_fmtalloc(const char *format, ...) { struct strbuf sb = STRBUF_INIT; va_list args; -- cgit 2.12.1