[Take 2] winex11.drv: Fix buffer overflow bug in X11DRV_KeyEvent()and X11DRV_ToUnicodeEx()

Dmitry Timoshkov dmitry at codeweavers.com
Sun Aug 24 06:15:26 CDT 2008


"Muneyuki Noguchi" <nogu.dev at gmail.com> wrote:

> Changes from the previous patch:
> - Add a new variable STRSIZE.

A define would be better IMO, or just use 64 directly, 2 places don't
justify the introduction of it.

> - Use HeapAlloc() and HeapFree() instead of malloc() and free().

I'd suggest to have an initial buffer of 64 bytes allocated on the stack,
and allocate a larger buffer only if required. That improves performance.

> - Return from a function when (re)allocation failed.

You have to call wine_tsx11_unlock() when needed on exit.

-- 
Dmitry.



More information about the wine-devel mailing list