Skip to content

Commit

Permalink
pcap-info: fix wrong check of options (use declard length and check e…
Browse files Browse the repository at this point in the history
…rrors)
  • Loading branch information
pc-anssi authored and chifflier committed Sep 25, 2024
1 parent 977cbcc commit 81d21d9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pcap-info/src/interface.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use pcap_parser::*;
use std::convert::TryFrom;
use tracing::warn;

/// Information related to a network interface used for capture
pub struct InterfaceInfo {
Expand Down Expand Up @@ -68,7 +69,10 @@ pub fn pcapng_build_interface<'a>(
}
_ => (),
}
options.push((opt.code, opt.value.to_vec()));
match opt.as_bytes() {
Some(value) => options.push((opt.code, value.to_vec())),
None => warn!("Option with code {} has invalid value", opt.code),
}
}
InterfaceInfo {
if_index,
Expand Down

0 comments on commit 81d21d9

Please sign in to comment.