Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(evdev) EVIOCGBIT(_, x) treat (x) as len not nbits
The history and tracking for this one seem to be an interesting rabbit hole if you are absolutely bored with life but not bored with bittwiddle syscall interfaces written in an era where every bit is precious and 64 bit memory not a thing for the commoners. As far as memory serves this was initially written from documentation that treated the len field being the number of bits and not the size of the destination buffer. The same detail can be found piecewise in Android suggesting that I was not hallucinating the entire time. The kernel interface however treats this as the buffer size (so we are in multiples of 8 wrong in the one direction or the other) and this likely triggered on FreeBSDs implementation of evdev which explicitly bzeroes up to len, 0ing up the stack - otherwise it would only be visible on devices with a whole lot of keys. It also looks like other consumers of the interface just yolo overallocates instead.
- Loading branch information