Skip to content

Commit 7072ab9

Browse files
Malaykeowen-mc
andauthored
Update go/ql/src/experimental/CWE-770/DenialOfServiceGood.go
Co-authored-by: Owen Mansel-Chan <[email protected]>
1 parent 22cb9ed commit 7072ab9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

go/ql/src/experimental/CWE-770/DenialOfServiceGood.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ func OutOfMemoryGood(w http.ResponseWriter, r *http.Request) {
1212
MaxValue := 6
1313
queryStr := query.Get("n")
1414
collectionSize, err := strconv.Atoi(queryStr)
15-
if err != nil || collectionSize < 0 {
16-
http.Error(w, "Bad request", http.StatusBadRequest)
15+
if err != nil {
16+
http.Error(w, err.Error(), http.StatusBadRequest)
1717
return
1818
}
19-
if collectionSize > MaxValue {
19+
if collectionSize < 0 || collectionSize > MaxValue {
2020
http.Error(w, "Bad request", http.StatusBadRequest)
2121
return
2222
}

0 commit comments

Comments
 (0)