[PATCH 0/1] locale: Avoid use-after-invalidate
Simon Richter
Simon.Richter@hogyros.de
Fri Nov 6 18:18:58 GMT 2026
Hi,
on my Debian bookworm system (glibc 2.36), I am getting an error message
containing garbage bytes. The reason for that appears to be that
setlocale() returns a pointer to a statically allocated area, and the next
call to setlocale() may overwrite that, so if the return value needs to be
preserved, it needs to be copied before the next call to setlocale().
This code is unchanged through the entire git-tracked history, so the bug
exists in older and newer releases as well, but setlocale() appears to
behave a bit differently in newer releases, making this difficult to
trigger.
The fifth byte of the garbage data being copied appears to always be a NUL
byte, so strdup() usually returns a string of length four or less, and
terminates, so I doubt there is much of a security impact here.
Nonetheless, it is a bug, so it may be worthwhile to backport.
Simon
Simon Richter (1):
locale: Avoid use-after-invalidate
locale/programs/record-status.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--
2.47.3
More information about the Libc-alpha
mailing list