Skip to content

TryParseReverseDomain should fail on invalid IPv4 addresses such as one octet less or more #41

@zbalkan

Description

@zbalkan

When one ore more octets are missing the Span<byte> buffer = stackalloc byte[4]; line fills it with zeroes, therefore covers the error.

When one or more octets are extra, for (int i = 0, j = parts.Length - 3; (i < 4) && (j > -1); i++, j--) loop covers as it ignores the extras.

I added an explicit guard clause for IPv4 addresses.

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