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-shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/ui-shared.c') diff --git a/source/ui-shared.c b/source/ui-shared.c index 88e5075..4084748 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -1237,7 +1237,7 @@ void cgit_compose_snapshot_prefix(struct strbuf *filename, const char *base, * i.e. each stripped tag can be inverted without ambiguities. */ if (repo_get_oid(the_repository, fmt("refs/tags/%s", ref), &oid) == 0 && - (ref[0] == 'v' || ref[0] == 'V') && isdigit(ref[1]) && + (ref[0] == 'v' || ref[0] == 'V') && isdigit((unsigned char)ref[1]) && ((repo_get_oid(the_repository, fmt("refs/tags/%s", ref + 1), &oid) == 0) + (repo_get_oid(the_repository, fmt("refs/tags/v%s", ref + 1), &oid) == 0) + (repo_get_oid(the_repository, fmt("refs/tags/V%s", ref + 1), &oid) == 0) == 1)) -- cgit v2.8.0