musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
diff options
context:
space:
mode:
authorIsaiah Poston <isaiah@ilposton.com>2022年03月12日 18:21:56 -0600
committerRich Felker <dalias@aerifal.cx>2022年03月16日 19:29:38 -0400
commit6d8a515796270eb6cec8a278cb353a078a10f09a (patch)
tree843dae50fcbe6a1390ed86ef62067ded6b7c48ed
parent760f5d7efed4d4761875334f8c4e6398be308cc9 (diff)
downloadmusl-6d8a515796270eb6cec8a278cb353a078a10f09a.tar.gz
fix invalid free of duplocale object when malloc has been replaced
newlocale and freelocale use __libc_malloc and __libc_free, but duplocale used malloc. If malloc was replaced, this resulted in invalid free using the wrong allocator when passing the result of duplocale to freelocale. Instead, use libc-internal malloc for duplocale. This bug was introduced by commit 1e4204d522670a1d8b8ab85f1cfefa960547e8af.
Diffstat
-rw-r--r--src/locale/duplocale.c 5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/locale/duplocale.c b/src/locale/duplocale.c
index 030b64cb..5ce33ae6 100644
--- a/src/locale/duplocale.c
+++ b/src/locale/duplocale.c
@@ -3,6 +3,11 @@
#include "locale_impl.h"
#include "libc.h"
+#define malloc __libc_malloc
+#define calloc undef
+#define realloc undef
+#define free undef
+
locale_t __duplocale(locale_t old)
{
locale_t new = malloc(sizeof *new);
generated by cgit v1.2.1 (git 2.18.0) at 2025年10月05日 00:09:14 +0000

AltStyle によって変換されたページ (->オリジナル) /