-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix undefined behavior in packet field setters
It is currently possible to trigger undefined behavior in field setters created by the `packet` macro, such as `MutableIpv4Packet::set_payload`, by setting a buffer larger than the remaining space in the packet buffer. Fix this by replacing the unsafe `copy_nonoverlapping` call with `copy_from_slice`. This function still compiles to `memcpy`, but includes a range check which which will panic if the destination buffer is too small. Fixes #449. Fixes #411.
- Loading branch information
Showing
2 changed files
with
27 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters