Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of truncated descriptors #201

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

martinling
Copy link
Member

It was possible for DescriptorIterator::next to panic when there were enough bytes for the next descriptor's length and type, but not enough to make up its declared length.

I hit this in a capture where the host only read 255 bytes of a configuration, which was evidently larger than that, such that the read ended part way through a class descriptor.

This PR overhauls the implementation to handle truncation better, and adds a test case.

@miek miek self-requested a review October 16, 2024 16:11
@miek miek merged commit 480fc38 into greatscottgadgets:main Oct 17, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants