fix: read of uninitialized data at inChar[0]
This is a defensive fix, might cause unexpected program exit if triggered. The loop will iterate at least once when nbytes==0, but this value indicates XLookupString did not fill in any data, so the entire buffer is undefined. Using memset() before or inChar[0]=0 after XLookupString did not fix the issue. Using inChar[0]=0 immediately before the loop did fix as well. But this patch seems to be the best approach.
This commit is contained in:
parent
1ca23ca0a2
commit
18a4dddc2b
|
|
@ -599,7 +599,7 @@ keys_and_buttons:
|
|||
idxmax = (nbytes == 0) ? 1 : nbytes;
|
||||
for (idx = 0; idx < idxmax; idx++)
|
||||
{
|
||||
if (inChar[idx] == 3) /* Ctrl-C interrupt */
|
||||
if (nbytes > 0 && inChar[idx] == 3) /* Ctrl-C interrupt */
|
||||
{
|
||||
if (SigInterruptPending)
|
||||
MainExit(0); /* double Ctrl-C */
|
||||
|
|
|
|||
Loading…
Reference in New Issue