Leak in XKeysymToString

Thomas Dickey dickey at his.com
Sat Aug 20 18:47:59 UTC 2022


On Sat, Aug 20, 2022 at 09:51:42AM -0700, Alan Coopersmith wrote:
> Thanks - while gitlab is our preferred method, when that's not possible,
> we prefer using the xorg-devel mailing list (cc'ed) instead of trying to
> guess which individual developer to contact.
> 
> This bug has been previously reported, but no one has developed a good
> fix yet - I don't know if many XKeysymToString callers keep references to
> the returned pointers and would be broken if those pointers suddenly had a
> different string or were invalid due to a realloc() call.

The manpage hints that callers should make a copy of the string,
since that "static area" implies that the library overwrites the
data for each call:

       The returned string is in a static area and must not be modified.  The
       returned string is in the Host Portable Character Encoding.  If the
       specified KeySym is not defined, XKeysymToString returns a NULL.

-- 
Thomas E. Dickey <dickey at invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20220820/6216240e/attachment.sig>


More information about the xorg-devel mailing list