Skip to content

Fix overflow on XmbLookupString buffer

Alan Coopersmith requested to merge alanc/xev:patch into master

The returned nmbbytes value is the length we need the buffer to be, but the current size is only bsize. We can't store a NUL at buf[nmbbytes] before the realloc, so only do this when the buffer is sized properly.

Signed-off-by: Mikael Magnusson <mikachu@gmail.com>
[ismael@iodev.co.uk: Moved string termination out of the loop]
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Edited by Alan Coopersmith

Merge request reports