On macOS, prevent key_event_buffer overflows
On macOS, key_event_buffer
is an unguarded C array that will overflow in paste operations > 512 chars (see insertText
).
This makes the buffer a resizing vector.
The same kind of implementation exists for Windows, but there it's ok, as only a single char will be added per event (WM_CHAR
), and there's an ERR_BREAK
guarding against buffer overflow. On OSUWP, there's also a guard. On X11 there's no key event buffering of this kind.