add zero max ports error

This commit is contained in:
soypat
2025-07-15 00:57:24 -03:00
parent ad22c61b28
commit 63dc5d1079
4 changed files with 8 additions and 0 deletions
+2
View File
@@ -27,6 +27,8 @@ func (ps *StackPorts) ResetTCP(maxNodes int) error {
func (ps *StackPorts) Reset(protocol uint64, dstPortOffset uint16, maxNodes int) error {
if protocol > math.MaxUint16 {
return errInvalidProto
} else if maxNodes <= 0 {
return errZeroMaxNodes
}
ps.handlers = slices.Grow(ps.handlers[:0], maxNodes)
*ps = StackPorts{