Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 21 Oct 2022 23:17:20 +0200
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: [RFC PATCH] implement strndupa

Signed-off-by: Ismael Luceno <ismael@...ev.co.uk>
---
 include/string.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/string.h b/include/string.h
index 43ad0942edd5..fda7b2e4f57c 100644
--- a/include/string.h
+++ b/include/string.h
@@ -89,6 +89,7 @@ void explicit_bzero (void *, size_t);
 
 #ifdef _GNU_SOURCE
 #define	strdupa(x)	strcpy(alloca(strlen(x)+1),x)
+#define	strndupa(x, n)	strlcpy(alloca(strnlen((x), (n)), (x), (n))
 int strverscmp (const char *, const char *);
 char *strchrnul(const char *, int);
 char *strcasestr(const char *, const char *);
-- 
2.38.1

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.