Diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Cap the search with xstrndup alone
Diffstat (limited to 'source/cgit.c')
-rw-r--r--source/cgit.c5
1 file changed, 1 insertion, 4 deletions
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")) {