Skip to content

NetworkInterface using incorrect field of Windows IP_ADAPTER_PREFIX structure to get prefix length #441

@cryptoknight

Description

@cryptoknight

When getting the prefix length of an IP address from the Windows IP_ADAPTER_PREFIX structure, the current implementation of NetworkInterface is incorrectly using the Length field, which contains the size of the structure itself, instead of the PrefixLength field. This bug only affects builds for Windows XP and Server 2003, since NetworkInterface correctly gets the prefix length from a different structure on newer versions of Windows. It causes incorrect results on 32-bit builds and a runtime assertion violation on 64-bit builds (where the size of the IP_ADAPTER_PREFIX structure is larger than the maximum prefix length of an IPv4 address).

Reference:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366065(v=vs.85).aspx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions