From 5478037e99beb2fec78f94405fef9620966b434c Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 13:33:25 -0700 Subject: Cap the search with xstrndup alone --- source/cgit.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'source') diff --git a/source/cgit.c b/source/cgit.c index dbce55b..10ed536 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -725,10 +725,7 @@ static void apply_query_param(const char *name, const char *value) } else if (!strcmp(name, "qt")) { ctx.qry.grep = xstrdup(value); } else if (!strcmp(name, "q")) { - if (strlen(value) > MAX_SEARCH_LEN) - ctx.qry.search = xstrndup(value, MAX_SEARCH_LEN); - else - ctx.qry.search = xstrdup(value); + ctx.qry.search = xstrndup(value, MAX_SEARCH_LEN); } else if (!strcmp(name, "h")) { ctx.qry.head = xstrdup(value); } else if (!strcmp(name, "id")) { -- cgit