Skip to content

Commit

Permalink
fix: prevent integer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ksw2000 committed Dec 19, 2024
1 parent de0df09 commit 75a611b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tcplisten/tcplisten_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ func maxAckBacklog(n int) int {
size = 32
}

var maxUint uint = 1<<size - 1
if uint(n) > maxUint {
n = int(maxUint)
u := 1<<size - 1
if n > u {
n = u
}
return n
}
Expand Down

0 comments on commit 75a611b

Please sign in to comment.