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 push ethernet corrupts data #96

Merged
merged 1 commit into from
May 9, 2020

Conversation

drunkirishcoder
Copy link
Contributor

Description

EthernetHeader is defined as a union. The size of the union is 22 bytes even though a tagless header only needs 14 bytes. On push the buffer is extended by 14 bytes, so the 8-byte overflow will corrupt the data following the extended segment. This fixes the bug by only writing 14 bytes.

Type of change

  • Bug fix

Checklist

  • Associated tests

Copy link
Member

@zeeshanlakhani zeeshanlakhani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comment. currently, curl to codecov will fail until we get the fix in @94.

/// mbuf.write_data(offset, &EthernetHeader::default())?;
/// ```
#[capsule::test]
fn bug_push_ethernet_corrupts_buffer() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drunkirishcoder really want to go w/ this name/comment, and not something more general?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed, this test is very specific to this piece of bad code. otherwise, the test wouldn't make sense without this additional context. will mark the test with the release version that has the bug and keep the comments.

@drunkirishcoder drunkirishcoder merged commit d17746c into master May 9, 2020
@drunkirishcoder drunkirishcoder deleted the djin/hotfix-ethernet-push branch May 9, 2020 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants