st icon indicating copy to clipboard operation
st copied to clipboard

Fix buffer overflow in input handling

Open AndyGozas opened this issue 2 years ago • 1 comments

kpress function in x.c previously relied on the wrong understanding of XmbLookupString behavior. When the composed string is longer than the available buffer, the buffer is not initialized and the actual length of the data available to read is returned, not the amount of data written. When that amount is later used to process the contents of this buffer, not only will the random contents of the uninitialized buffer be sent directly to the terminal and whichever application is now running in it, but possibly also whatever is in the memory after that buffer, leading to undefined behavior and possible random command execution.

AndyGozas avatar Aug 28 '22 22:08 AndyGozas

This is a pull request for issue #341

AndyGozas avatar Aug 28 '22 22:08 AndyGozas