ipaddr: Handle ipaddress index in network correctly (#57896)
This commit prevents integer indices from being parsed as ip nets Fixes #57895 Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
This commit is contained in:
parent
0f12e1c7d8
commit
e7c39460ed
2 changed files with 3 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- 'ipaddr: prevent integer indices from being parsed as ip nets'
|
|
@ -630,7 +630,7 @@ def ipaddr(value, query='', version=False, alias='ipaddr'):
|
|||
# address/network is inside that specific subnet
|
||||
try:
|
||||
# ?? 6to4 and link-local were True here before. Should they still?
|
||||
if query and (query not in query_func_map or query == 'cidr_lookup') and ipaddr(query, 'network'):
|
||||
if query and (query not in query_func_map or query == 'cidr_lookup') and not str(query).isdigit() and ipaddr(query, 'network'):
|
||||
iplist = netaddr.IPSet([netaddr.IPNetwork(query)])
|
||||
query = 'cidr_lookup'
|
||||
except Exception:
|
||||
|
|
Loading…
Reference in a new issue