mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 06:10:54 +03:00
ip lists: check the list size before parsing the IP
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user