Escape literal data file name and data prefix.
- This is attacker controlled data which must be sanitizied.
This commit is contained in:
parent
9b1d122789
commit
b798194808
@ -258,8 +258,8 @@ where
|
||||
}
|
||||
inspect_signatures(sq, output, &sigs)?;
|
||||
if ! literal_prefix.is_empty() {
|
||||
writeln!(output, " Data: {:?}{}",
|
||||
String::from_utf8_lossy(&literal_prefix),
|
||||
writeln!(output, " Data: {}{}",
|
||||
ui::Safe(&literal_prefix),
|
||||
if literal_prefix.len() == 40 { "..." } else { "" })?;
|
||||
}
|
||||
|
||||
|
@ -86,8 +86,8 @@ pub fn dump<W>(sq: &crate::Sq,
|
||||
let mut prefix = vec![0; 40];
|
||||
let n = pp.read(&mut prefix)?;
|
||||
vec![
|
||||
format!("Content: {:?}{}",
|
||||
String::from_utf8_lossy(&prefix[..n]),
|
||||
format!("Content: {}{}",
|
||||
ui::Safe(&prefix[..n]),
|
||||
if n == prefix.len() { "..." } else { "" }),
|
||||
]
|
||||
},
|
||||
@ -410,8 +410,8 @@ impl<'a, 'b, 'c> PacketDumper<'a, 'b, 'c> {
|
||||
Literal(ref l) => {
|
||||
writeln!(output, "{} Format: {}", i, l.format())?;
|
||||
if let Some(filename) = l.filename() {
|
||||
writeln!(output, "{} Filename: {:?}", i,
|
||||
String::from_utf8_lossy(filename))?;
|
||||
writeln!(output, "{} Filename: {}", i,
|
||||
ui::Safe(filename))?;
|
||||
}
|
||||
if let Some(timestamp) = l.date() {
|
||||
writeln!(output, "{} Timestamp: {}", i,
|
||||
|
Loading…
x
Reference in New Issue
Block a user