Skip to content

Commit

Permalink
Use ParseUint to test for overflow directly
Browse files Browse the repository at this point in the history
  • Loading branch information
dcarbone authored Dec 2, 2024
1 parent c520d1a commit 763bcf3
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions config/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,13 +570,10 @@ func parseTLSCiphers(s string) ([]uint16, error) {
}

func parseUint16(s string) (uint16, error) {
n, err := strconv.ParseUint(s, 0, 32)
n, err := strconv.ParseUint(s, 10, 16)
if err != nil {
return 0, err
}
if n > 1<<16 {
return 0, fmt.Errorf("%d out of range: [0..65535]", n)
}
return uint16(n), nil
}

Expand Down

0 comments on commit 763bcf3

Please sign in to comment.