diff options
Diffstat (limited to 'source/html.c')
| -rw-r--r-- | source/html.c | 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 3 insertions, 3 deletions
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; |
