mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] fix avoidable segfault in catclose
@ 2024-01-25  7:09 Ismael Luceno
  2024-01-25 14:05 ` Rich Felker
  2024-01-25 14:11 ` Markus Wichmann
  0 siblings, 2 replies; 17+ messages in thread
From: Ismael Luceno @ 2024-01-25  7:09 UTC (permalink / raw)
  To: musl; +Cc: Rich Felker, Ismael Luceno

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@iodev.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


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-01-27 19:20 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25  7:09 [musl] [PATCH] fix avoidable segfault in catclose Ismael Luceno
2024-01-25 14:05 ` Rich Felker
2024-01-25 15:28   ` Ismael Luceno
2024-01-25 15:56     ` Rich Felker
2024-01-25 14:11 ` Markus Wichmann
2024-01-25 15:30   ` Ismael Luceno
2024-01-25 20:10   ` [musl] RE: [EXTERNAL] " Andy Caldwell
2024-01-25 21:25     ` Rich Felker
2024-01-26 17:13       ` Andy Caldwell
2024-01-26 17:27         ` Rich Felker
2024-01-26 19:12           ` Andy Caldwell
2024-01-26 19:57             ` Rich Felker
2024-01-26 20:16               ` Andy Caldwell
2024-01-27 11:04                 ` Szabolcs Nagy
2024-01-27 12:58                   ` Alexander Monakov
2024-01-27 14:56                     ` Rich Felker
2024-01-27 19:20                       ` Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).