fix: inf loop in PortUnion.Ports() when end=65535

fix: #1240

Any uint16 value is less than or equal to 65535.
This commit is contained in:
Haruue 2024-11-05 00:44:04 +09:00
parent 78598bfd1b
commit d65997c02b
No known key found for this signature in database
GPG key ID: F6083B28CBCBC148

View file

@ -1,6 +1,7 @@
package utils
import (
"math"
"sort"
"strconv"
"strings"
@ -91,6 +92,9 @@ func (u PortUnion) Ports() []uint16 {
for _, r := range u {
for i := r.Start; i <= r.End; i++ {
ports = append(ports, i)
if i == math.MaxUint16 {
break
}
}
}
return ports