Skip to content

Commit

Permalink
avoid int cast without limit check (#1038)
Browse files Browse the repository at this point in the history
  • Loading branch information
nopcoder authored Dec 10, 2020
1 parent f25a4e5 commit 211afbb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions gateway/operations/listobjects.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ func (controller *ListObjects) RequiredPermissions(request *http.Request, repoID
func (controller *ListObjects) getMaxKeys(o *RepoOperation) int {
params := o.Request.URL.Query()
maxKeys := ListObjectMaxKeys
if len(params.Get("max-keys")) > 0 {
parsedKeys, err := strconv.ParseInt(params.Get("max-keys"), 10, 64)
maxKeysParam := params.Get("max-keys")
if len(maxKeysParam) > 0 {
parsedKeys, err := strconv.Atoi(maxKeysParam)
if err == nil {
maxKeys = int(parsedKeys)
maxKeys = parsedKeys
}
}
return maxKeys
Expand Down

0 comments on commit 211afbb

Please sign in to comment.