From 3777842c1a4761a46a96d9b05e8cfbae68fa7177 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 30 Oct 2026 13:56:41 -0700 Subject: Cap the search with xstrndup alone --- source/cgit.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'source/cgit.c') 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 2.12.1