Skip to content

ethtool ioctl crashes if number of strings exceeds hardcoded value #1112

Open
@pspacek

Description

@pspacek

Version affected: c7da937

Problematic code:
https://github.com/svinota/pyroute2/blob/c7da937999dc59167f81f9466c80e891fb7be736/pyroute2/ethtool/ioctl.py#L284C14-L284C14

It turns out that comment

        # If you have more than 256 features on your NIC
        # they will not be seen by it

... is not correct. The code outright segfaults if number of strings returned exceeds hardcoded value. Easiest way to test is to manually drop the number to a small value, but it is practical problem e.g. in AWS VM type c5n.18xlarge which can return 1105 strings.

We already know the correct values from ioctl ETHTOOL_GSSET_INFO but it is not used in structure definition or checked anywhere. I might try to fix it but it will require redefining array sizes dynamically, I think.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions