Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 25 Jan 2024 08:09:49 +0100
From: Ismael Luceno <ismael@...ev.co.uk>
To: musl@...ts.openwall.com
Cc: Rich Felker <dalias@...c.org>,
	Ismael Luceno <ismael@...ev.co.uk>
Subject: [PATCH] fix avoidable segfault in catclose

catclose may be called with an invalid argument, particularly -1 may be
returned by catopen if there's an error.

Signed-off-by: Ismael Luceno <ismael@...ev.co.uk>
---
 src/locale/catclose.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/locale/catclose.c b/src/locale/catclose.c
index 54e24dd2163b..af959a58dfb5 100644
--- a/src/locale/catclose.c
+++ b/src/locale/catclose.c
@@ -8,6 +8,8 @@
 
 int catclose (nl_catd catd)
 {
+	if (catd == (nl_catd)-1)
+		return -1;
 	char *map = (char *)catd;
 	munmap(map, V(map+8)+20);
 	return 0;
-- 
2.43.0

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.