Skip to content

pnet_macros: Fix handle_vec_primitive for multi byte primitives#596

Merged
mrmonday merged 1 commit intolibpnet:masterfrom
jefftt:fix-vec-primitive
Jan 27, 2023
Merged

pnet_macros: Fix handle_vec_primitive for multi byte primitives#596
mrmonday merged 1 commit intolibpnet:masterfrom
jefftt:fix-vec-primitive

Conversation

@jefftt
Copy link
Copy Markdown

@jefftt jefftt commented Jan 11, 2023

Currently get_*() will panic for primitives larger than 1 byte with an array out of bounds, e.g. u32be because it will try to push for vec.capacity() times which is set to the number of bytes in the vec. The correct times to push is the number of elements, which is the number of bytes divided by the size.

@mrmonday
Copy link
Copy Markdown
Contributor

Looks good, thanks!

@mrmonday mrmonday merged commit 84d6cb6 into libpnet:master Jan 27, 2023
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