mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-09-01 02:28:41 +02:00
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 driver is a modification of the Stanford X10 driver. The modifications were done by Walter Scott and Eric Lunow at Lawrence Livermore National Labs.