Skip to content

ClientSubnetv4 Calculates Address Length Incorrectly. #4920

@wenxuan70

Description

@wenxuan70

Brief description

when the effective number of address digits in the ecs field in the dns packet is not a multiple of 8, a ValueError: invalid length of packed IP address string will be thrown.

Scapy version

2.7.0

Python version

3.13.5

Operating system

Linux 5.4.143

Additional environment information

No response

How to reproduce

from scapy.layers.dns import EDNS0ClientSubnet

b = b'\x00\x08\x00\x0c\x00\x02=\x00+\xaf\xa3\xc4\xed\xeeW\xb8'
p = EDNS0ClientSubnet(b)
# Note: source_plen is not a multiple of 8
assert p.source_plen == 61 and p.address == '2baf:a3c4:edee:57b8::'

Actual result

No response

Expected result

No response

Related resources

No response

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