Skip to content

Commit 1fe0d48

Browse files
committed
Check invalid query values
1 parent 791d3e4 commit 1fe0d48

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

routers/repo/view.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ func renderDirectory(ctx *context.Context, treeLink string) {
4949

5050
start := ctx.QueryInt("start")
5151
count := ctx.QueryInt("count")
52+
53+
// Check invalid values
54+
if start < 0 || count < 0 || start+count > len(entries) {
55+
start = 0
56+
count = len(entries)
57+
}
5258
entries = entries[start : start+count]
5359

5460
ctx.Data["Files"], err = entries.GetCommitsInfo(ctx.Repo.Commit, ctx.Repo.TreePath)

0 commit comments

Comments
 (0)