Skip to content

Commit

Permalink
fix: validate api input
Browse files Browse the repository at this point in the history
  • Loading branch information
Banyc committed Aug 9, 2023
1 parent 18eaf59 commit ac9be65
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion boringtun/src/device/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,12 @@ fn api_set(reader: &mut BufReader<&UnixStream>, d: &mut LockReadGuard<Device>) -
let mut cmd = String::new();

while reader.read_line(&mut cmd).is_ok() {
cmd.pop(); // remove newline if any
let end = cmd.pop(); // remove newline if any
if let Some(end) = end {
if end != '\n' {
return EPROTO;
}
}
if cmd.is_empty() {
return 0; // Done
}
Expand Down

0 comments on commit ac9be65

Please sign in to comment.