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-17-ilt@envs.net>
Date: Wed, 18 Nov 2026 15:49:58 +0300
From: illiliti <ilt@...s.net>
To: musl@...ts.openwall.com
Cc: illiliti <ilt@...s.net>
Subject: [PATCH v1 16/18] fts: harden fts_alloc with calloc

---
 src/misc/fts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/misc/fts.c b/src/misc/fts.c
index 1c2bc446..0fec99af 100644
--- a/src/misc/fts.c
+++ b/src/misc/fts.c
@@ -905,11 +905,11 @@ fts_alloc(FTS *sp, const char *name, size_t namelen)
 {
 	FTSENT *p;
 
-	if ((p = malloc(sizeof(FTSENT) + namelen)) == NULL)
+	if ((p = calloc(sizeof(FTSENT) + namelen, 1)) == NULL)
 		return (NULL);
 
 	if (!ISSET(FTS_NOSTAT))
-		if ((p->fts_statp = malloc(sizeof(*(p->fts_statp)))) == NULL) {
+		if ((p->fts_statp = calloc(sizeof(*(p->fts_statp)), 1)) == NULL) {
 			free(p);
 			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.