Skip to content

[HttpFoundation] IpUtils::checkIp4 incorrectly handles CIDR notation with subnet 0.0.0.0/0 #16055

@ultrafez

Description

@ultrafez

The checkIp4 method in IpUtils is able to check whether an IP belongs to a particular subnet specified in CIDR notation, however it incorrectly states that all IP addresses are not members of the subnet 0.0.0.0/0.

This is due to the check on the size of the netmask in IpUtils::checkIp4 - if the netmask is less than -1, then it immediately returns false, which is incorrect - all IPv4 addresses are members of the /0 subnet by default.

This can easily be fixed by adding a check for whether $netmask === 0, and if so, returning true immediately, since all IPs would be a member.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy