This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug locale/25123] Heap use-after-free in setlocale


https://sourceware.org/bugzilla/show_bug.cgi?id=25123

--- Comment #4 from Nguyễn Đức Mạnh <v.manhnd at vincss dot net> ---
(In reply to Florian Weimer from comment #3)
> The Perl coded looks invalid, particularly for multi-threaded code.  On
> POSIX, it should use uselocale to temporarily change the locale for the
> current thread.
> 
> That being said, you can make a copy of the returned string using strdup,
> and use that in the second setlocale call.

Please explain the usage of the return value of setlocale. As
https://linux.die.net/man/3/setlocale says, "The string returned is such that a
subsequent call with that string and its associated category will restore that
part of the process's locale." I see Perl follows this. Usage of strdup is not
mentioned anywhere in documents.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]