From 2767bfb2ea383196d0f5a787ed2a7c9ee11e73dc Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 12:53:15 -1000 Subject: Read a negative ref count as no limit summary-branches, summary-tags and max-ref-count already listed every ref at 0, but a negative value reached qsort as a count and crashed the summary and refs pages, and emptied the branch switcher. --- source/ui-refs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source/ui-refs.c') diff --git a/source/ui-refs.c b/source/ui-refs.c index e4a0dd0..890a959 100644 --- a/source/ui-refs.c +++ b/source/ui-refs.c @@ -294,7 +294,7 @@ void cgit_print_branches(int maxcount) print_branch_header(); collect_branches(&list); - if (maxcount == 0 || maxcount > list.count) + if (maxcount <= 0 || maxcount > list.count) maxcount = list.count; // The date sort covers the list, the name sort only the rows about to @@ -323,9 +323,7 @@ void cgit_print_tags(int maxcount) if (list.count == 0) return; qsort(list.refs, list.count, sizeof(*list.refs), cmp_date); - if (!maxcount) - maxcount = list.count; - else if (maxcount > list.count) + if (maxcount <= 0 || maxcount > list.count) maxcount = list.count; print_tag_header(); for (i = 0; i < maxcount; i++) -- cgit