From 83ee977746528be13144c4d6e8c091104416d0b0 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Thu, 23 Jan 2025 08:07:33 +0100 Subject: [PATCH] ip lists: check the list size before parsing the IP Signed-off-by: Nicola Murino --- internal/dataprovider/iplist.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/dataprovider/iplist.go b/internal/dataprovider/iplist.go index f24da8e6..bc3b5b99 100644 --- a/internal/dataprovider/iplist.go +++ b/internal/dataprovider/iplist.go @@ -418,6 +418,10 @@ func (l *IPList) IsListed(ip, protocol string) (bool, int, error) { l.mu.RLock() defer l.mu.RUnlock() + if l.Ranges.Len() == 0 { + return false, 0, nil + } + parsedIP := net.ParseIP(ip) if parsedIP == nil { return false, 0, fmt.Errorf("invalid IP %s", ip)