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

Muneyuki Noguchi nogu.dev at gmail.com
Tue Aug 26 19:18:53 CDT 2008


Thank you for your comments.

> 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.

lpChar and Str are referenced after XmbLookupString() or XLookupString() is called. If both a buffer on stack and a buffer on heap can be created, every time the buffer is referenced, I need to check whether the used buffer is one on stack or not:

 if (isStack) {
   lpChar[0] = 0;
 } else {
   lpChar2[0] = 0;
 }

This implementation is ugly and won't improve performance so much.

-- 
Muneyuki Noguchi



More information about the wine-devel mailing list