Skip to content

Commit

Permalink
Memset payload buffers in UDP/Raw PacketBuffer::reset.
Browse files Browse the repository at this point in the history
  • Loading branch information
batonius committed Aug 31, 2017
1 parent cf22ba2 commit 3da43fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/socket/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ impl<'a> PacketBuffer<'a> {

impl<'a> Resettable for PacketBuffer<'a> {
fn reset(&mut self) {
for i in 0..self.size {
self.payload[i] = 0u8;
}
self.size = 0;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/socket/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ impl<'a> PacketBuffer<'a> {
impl<'a> Resettable for PacketBuffer<'a> {
fn reset(&mut self) {
self.endpoint = Default::default();
for i in 0..self.size {
self.payload[i] = 0u8;
}
self.size = 0;
}
}
Expand Down

0 comments on commit 3da43fe

Please sign in to comment.