Re: [hackers] [st][PATCH] Fix buffer overflow when handling composed input

2022-10-24 Thread Andy Gozas
On 2022-10-24 10:30 AM, NRK wrote: On Mon, Oct 24, 2022 at 01:10:29PM +0300, Santtu Lakkala wrote: The dynmaic[sic] version incorrectly passes sizeof(buf), where buf is char *, as the size of buffer in the "happy case" leading to unnecessary hits to the dynamic path. Ah yes, the classic. Att

Re: [hackers] [st][PATCH] Fix buffer overflow when handling composed input

2022-10-24 Thread Andy Gozas
On 2022-10-24 10:01 AM, NRK wrote: On Mon, Oct 24, 2022 at 09:21:37AM +, Andy Gozas wrote: • XmbLookupString leaves the ksym unchanged if not filled and XLookupString [probably] sets it to NoSymbol (that's what XLookupKeysym does, but whether or not XLookupString shares this behavior is unc

Re: [hackers] [st][PATCH] Fix buffer overflow when handling composed input

2022-10-24 Thread NRK
On Mon, Oct 24, 2022 at 01:10:29PM +0300, Santtu Lakkala wrote: > The dynmaic[sic] version incorrectly passes sizeof(buf), where buf is char > *, as the size of buffer in the "happy case" leading to unnecessary hits to > the dynamic path. Ah yes, the classic. Attached ammended version of the dynma

Re: [hackers] [st][PATCH] Fix buffer overflow when handling composed input

2022-10-24 Thread Santtu Lakkala
On 24.10.2022 13.01, NRK wrote:> But which approach to take is the maintainer's call, not mine. I've attched both fixed-size and dynamic-allocation patch (but simplified without goto). The dynmaic[sic] version incorrectly passes sizeof(buf), where buf is char *, as the size of buffer in the "h

Re: [hackers] [st][PATCH] Fix buffer overflow when handling composed input

2022-10-24 Thread NRK
On Mon, Oct 24, 2022 at 09:21:37AM +, Andy Gozas wrote: > • XmbLookupString leaves the ksym unchanged if not filled and XLookupString > [probably] sets it to NoSymbol (that's what XLookupKeysym does, but whether > or not XLookupString shares this behavior is unclear [1]), so we can just > set i

Re: [hackers] [st][PATCH] Fix buffer overflow when handling composed input

2022-10-24 Thread Andy Gozas
On 2022-10-24 12:35 AM, NRK wrote: On Sun, Oct 23, 2022 at 04:18:42PM +, Andy Gozas wrote: > St relies on an incorrect assumption of how XmbLookupString function > behaves. Looking at the XmbLookupString manpage [0] reveals more trouble. It seems that `ksym` might be used uninitalized as