VirtualBox

Ignore:
Timestamp:
Oct 21, 2021 12:26:53 AM (3 years ago)
Author:
vboxsync
Message:

NAT/Net: Convert assertion about RTNetStrToIPv4Cidr returning a valid
prefix into an explicit test and return an error message.
bugref:9330, bugref:9929.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp

    r90078 r91916  
    609609    }
    610610
    611     if (iPrefixLength > 30)
    612     {
    613         reportError("IPv4 prefix length %d is too narrow\n", iPrefixLength);
     611    if (iPrefixLength > 30 || 0 >= iPrefixLength)
     612    {
     613        reportError("Invalid IPv4 prefix length %d\n", iPrefixLength);
    614614        return VERR_INVALID_PARAMETER;
    615615    }
     
    617617    rc = RTNetPrefixToMaskIPv4(iPrefixLength, &Mask4);
    618618    AssertRCReturn(rc, rc);
    619     AssertReturn(iPrefixLength > 0, VERR_INVALID_PARAMETER);
     619
     620    /** @todo r=uwe Check the address is unicast, not a loopback, etc. */
    620621
    621622    RTNETADDRIPV4 Addr4;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette