Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/input/mouse/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ impl RawMouseInput {
if let Ok(file) = File::open(&path) {
let fd = file.as_raw_fd();

// Query REL capabilities (need at least 2 bytes for REL_WHEEL which is bit 8)
let mut rel_bits = [0u8; 2];
// EVIOCGBIT_REL encodes an 8-byte output buffer. Allocating only
// two bytes lets the kernel overwrite adjacent stack memory.
let mut rel_bits = [0u8; 8];
let ret = unsafe { libc::ioctl(fd, EVIOCGBIT_REL, rel_bits.as_mut_ptr()) };

if ret >= 0 {
Expand Down