Skip to content

Commit

Permalink
validate maxResults
Browse files Browse the repository at this point in the history
  • Loading branch information
ohaibbq committed Apr 8, 2024
1 parent 823ef34 commit 52741b4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,10 @@ func (h *jobsGetQueryResultsHandler) Handle(ctx context.Context, r *jobsGetQuery
rows = nil
}

if r.maxResults < -1 {
return nil, fmt.Errorf("invalid maxResults parameter; must be greater than or equal to [-1], got [%i]", r.maxResults)
}

if r.maxResults != maxResultsDefaultValue {
rows = rows[:min(int64(len(rows)), r.maxResults)]
}
Expand Down

0 comments on commit 52741b4

Please sign in to comment.