Ignore key codes over 0xf000 on insert

This commit is contained in:
wz 2023-05-19 19:41:14 +03:00
parent fe646f52c1
commit 723cadaff0

View file

@ -938,18 +938,22 @@ fn main() -> ! {
#[cfg(all(feature="debuginject", not(feature="rawserial")))] #[cfg(all(feature="debuginject", not(feature="rawserial")))]
if let Some(conn) = listener_conn { if let Some(conn) = listener_conn {
if key != '\u{0000}' { if key != '\u{0000}' {
log::info!("injecting key '{}'({:x})", key, key as u32); // always be noisy about this, it's an exploit path if key > '\u{f000}' {
xous::try_send_message(conn, log::info!("ignoring key '{}'({:x})", key, key as u32); // ignore macOS weird characters
xous::Message::new_scalar(listener_op.unwrap(), } else {
key as u32 as usize, log::info!("injecting key '{}'({:x})", key, key as u32); // always be noisy about this, it's an exploit path
'\u{0000}' as u32 as usize, xous::try_send_message(conn,
'\u{0000}' as u32 as usize, xous::Message::new_scalar(listener_op.unwrap(),
'\u{0000}' as u32 as usize, key as u32 as usize,
) '\u{0000}' as u32 as usize,
).unwrap_or_else(|_| { '\u{0000}' as u32 as usize,
log::info!("Input overflow, dropping keys!"); '\u{0000}' as u32 as usize,
xous::Result::Ok )
}); ).unwrap_or_else(|_| {
log::info!("Input overflow, dropping keys!");
xous::Result::Ok
});
}
} }
} }