From 3aa7b7b46438dcb7bf074e1dc7a9ec4924df3de7 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Wed, 15 Jul 2026 13:20:41 -1000 Subject: Cast signed chars before ctype calls A plain char is undefined in the ctype functions for negative values, which a high byte produces wherever char is signed. --- source/ui-tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/ui-tree.c') diff --git a/source/ui-tree.c b/source/ui-tree.c index 9181b1b..f537442 100644 --- a/source/ui-tree.c +++ b/source/ui-tree.c @@ -93,7 +93,7 @@ static void print_binary_buffer(char *buf, unsigned long size) buf[idx] & 0xff); html(" "); for (idx = 0; idx < ROWLEN && ofs + idx < size; idx++) - ascii[idx] = isgraph(buf[idx]) ? buf[idx] : '.'; + ascii[idx] = isgraph((unsigned char)buf[idx]) ? buf[idx] : '.'; ascii[idx] = '\0'; html_txt(ascii); html("\n"); @@ -271,7 +271,7 @@ static void render_ls_item(const struct object_id *oid, const char *pathname, free(buf); strbuf_release(&linkpath); } - htmlf("%li", size); + htmlf("%lu", size); html(""); cgit_log_link("log", NULL, "button", ctx.qry.head, -- cgit v2.8.0