Skip to content

pnet_macros: fix num_bytes calculation#547

Merged
mrmonday merged 3 commits intolibpnet:masterfrom
nyantec:feature-fix-num-bytes
Apr 8, 2022
Merged

pnet_macros: fix num_bytes calculation#547
mrmonday merged 3 commits intolibpnet:masterfrom
nyantec:feature-fix-num-bytes

Conversation

@yu-re-ka
Copy link
Copy Markdown

@yu-re-ka yu-re-ka commented Apr 4, 2022

The following would panic in debug-mode, and produce garbage in release-mode:

#[packet]
pub struct Test {
    banana: u2,
    apple: u4,
    potato: u6,
    the_rest: u20be,
    #[payload]
    payload: Vec<u8>,
}

@stappersg
Copy link
Copy Markdown
Contributor

Warning: "github" squashes commits by default.

I think the two commits in this merge request should go in two separate commits.

@yu-re-ka
Copy link
Copy Markdown
Author

yu-re-ka commented Apr 6, 2022

@mrmonday can you have a look?

@mrmonday
Copy link
Copy Markdown
Contributor

mrmonday commented Apr 7, 2022

Could you add your sample struct into pnet_macros/tests/run-pass/ please?

Sorry for the delay.

@mrmonday
Copy link
Copy Markdown
Contributor

mrmonday commented Apr 7, 2022

In future, the best way to get my attention is to ping me on IRC (#libpnet on irc.libera.chat) - github notifications have a habit of getting buried in my inbox :)

@yu-re-ka
Copy link
Copy Markdown
Author

yu-re-ka commented Apr 8, 2022

Could you add your sample struct into pnet_macros/tests/run-pass/ please?

Done

Sorry for the delay.

A few days are not a problem, if it gets into the weeks we should maybe talk about adding some more maintainers ;)

@yu-re-ka yu-re-ka force-pushed the feature-fix-num-bytes branch from fcfee53 to 3daa033 Compare April 8, 2022 14:20
@mrmonday
Copy link
Copy Markdown
Contributor

mrmonday commented Apr 8, 2022

I keep adding new maintainers, they always seem to disappear after a while though...

@mrmonday mrmonday merged commit c10134b into libpnet:master Apr 8, 2022
@mrmonday
Copy link
Copy Markdown
Contributor

mrmonday commented Apr 8, 2022

Looks good, thanks!

@yu-re-ka yu-re-ka deleted the feature-fix-num-bytes branch April 8, 2022 15:33
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.

4 participants