From ffdbdb3d0209aa7edad0199cca0b1394d294b595 Mon Sep 17 00:00:00 2001 From: Brahim HAMDOUNI Date: Sat, 15 May 2021 22:16:24 +0800 Subject: [PATCH] Check negative limit command parameter (#358) (#359) fix #358 Co-authored-by: Brahim Hamdouni Reviewed-on: https://gitea.com/gitea/tea/pulls/359 Reviewed-by: techknowlogick Reviewed-by: Norwin Co-authored-by: Brahim HAMDOUNI Co-committed-by: Brahim HAMDOUNI --- modules/context/context.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/context/context.go b/modules/context/context.go index 909c4d5..cf5eb7d 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -39,6 +39,9 @@ type TeaContext struct { func (ctx *TeaContext) GetListOptions() gitea.ListOptions { page := ctx.Int("page") limit := ctx.Int("limit") + if limit < 0 { + limit = 0 + } if limit != 0 && page == 0 { page = 1 }