Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20261118125553.9133-18-ilt@envs.net>
Date: Wed, 18 Nov 2026 15:49:59 +0300
From: illiliti <ilt@...s.net>
To: musl@...ts.openwall.com
Cc: illiliti <ilt@...s.net>
Subject: [PATCH v1 17/18] fts: backport NULL deref fix from OpenBSD

openbsd src commit: 35a15bab90f672da7024f7a288eef35a2f8066e9

fts_open() requires that the list passed as argument to contain
at least one path. When the list is empty (contain only a NULL pointer),
return EINVAL instead of pretending to succeed, which will cause a NULL
pointer deference in a later fts_read() call. From FreeBSD.
---
 src/misc/fts.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/misc/fts.c b/src/misc/fts.c
index 0fec99af..9e682f38 100644
--- a/src/misc/fts.c
+++ b/src/misc/fts.c
@@ -100,6 +100,12 @@ fts_open(char * const *argv, int options,
 		return (NULL);
 	}
 
+	/* At least one path must be specified. */
+	if (*argv == NULL) {
+		errno = EINVAL;
+		return (NULL);
+	}
+
 	/* Allocate/initialize the stream */
 	if ((sp = calloc(1, sizeof(FTS))) == NULL)
 		return (NULL);
-- 
2.55.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.