Skip to content

Commit 8818201

Browse files
Potential fix for code scanning alert no. 4: Incorrect conversion between integer types
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 6a32e9d commit 8818201

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

handlers/form.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package handlers
22

33
import (
4+
"math"
45
"net/http"
56
"strconv"
67
"strings"
@@ -21,6 +22,9 @@ func parseFormInt(r *http.Request, field string, def int, maximum int) int {
2122
if v > uint64(maximum) {
2223
return maximum
2324
}
25+
if v > math.MaxInt {
26+
return maximum
27+
}
2428
return int(v)
2529
}
2630
}

0 commit comments

Comments
 (0)