Skip to content

Commit

Permalink
Check invalid query values
Browse files Browse the repository at this point in the history
  • Loading branch information
typeless committed Jan 6, 2017
1 parent 791d3e4 commit 1fe0d48
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions routers/repo/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ func renderDirectory(ctx *context.Context, treeLink string) {

start := ctx.QueryInt("start")
count := ctx.QueryInt("count")

// Check invalid values
if start < 0 || count < 0 || start+count > len(entries) {
start = 0
count = len(entries)
}
entries = entries[start : start+count]

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

0 comments on commit 1fe0d48

Please sign in to comment.