Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sat, 12 Mar 2022 18:21:56 -0600
From: Isaiah Poston <>
Cc: Isaiah Poston <>
Subject: [PATCH] use libc-internal malloc for duplocale

newlocale and freelocale use __libc_malloc and __libc_free, but
duplocale uses malloc. This prevents invalid reads when locales created
by duplocale use a different malloc allocator than the internal one
(e.g. when using an LD_PRELOAD malloc tool such as valgrind).

This bug was introduced by commit
 src/locale/duplocale.c | 5 +++++
 1 file changed, 5 insertions(+)

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);

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.