net: Reject + sign when parsing subnet mask

It does not make sense and it is rejected by other parsers as well:

>>> ipaddress.ip_network("1.2.3.0/+24")
ValueError: '1.2.3.0/+24' does not appear to be an IPv4 or IPv6 network
This commit is contained in:
MarcoFalke
2025-05-15 20:42:21 +02:00
parent fa89652e68
commit fab4c2967d
2 changed files with 3 additions and 4 deletions

View File

@@ -150,7 +150,6 @@ BOOST_AUTO_TEST_CASE(embedded_test)
BOOST_AUTO_TEST_CASE(subnet_test)
{
BOOST_CHECK(LookupSubNet("1.2.3.0/24") == LookupSubNet("1.2.3.0/255.255.255.0"));
BOOST_CHECK(LookupSubNet("1.2.3.0/24") != LookupSubNet("1.2.4.0/255.255.255.0"));
BOOST_CHECK(LookupSubNet("1.2.3.0/24").Match(ResolveIP("1.2.3.4")));
@@ -185,6 +184,7 @@ BOOST_AUTO_TEST_CASE(subnet_test)
// Check valid/invalid
BOOST_CHECK(LookupSubNet("1.2.3.0/0").IsValid());
BOOST_CHECK(!LookupSubNet("1.2.3.0/-1").IsValid());
BOOST_CHECK(!LookupSubNet("1.2.3.0/+24").IsValid());
BOOST_CHECK(LookupSubNet("1.2.3.0/32").IsValid());
BOOST_CHECK(!LookupSubNet("1.2.3.0/33").IsValid());
BOOST_CHECK(!LookupSubNet("1.2.3.0/300").IsValid());