From 41ba28892a04ab8a35a2751b4b7801414706f284 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 6 May 2021 16:49:09 -0400 Subject: Forget about ARG_MAX. The likelihood of accepting an unfathomably large input from the environment is pretty low --- lib/cleanpath.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'lib/cleanpath.c') diff --git a/lib/cleanpath.c b/lib/cleanpath.c index c7f8bc9..b849199 100644 --- a/lib/cleanpath.c +++ b/lib/cleanpath.c @@ -4,18 +4,6 @@ #include "config.h" #include "cleanpath.h" -#if OS_LINUX -#if HAVE_SYS_LIMIT_H -#include -#endif // HAVE_SYS_LIMIT_H - -#if HAVE_LINUX_LIMIT_H -#include -#endif // HAVE_LINUX_LIMIT_H -#else -#include -#endif - /** * Split path into parts by sep * @param path a string (e.g. "/path1:/path2:/pathN") @@ -33,7 +21,7 @@ struct CleanPath *cleanpath_init(const char *path, const char *sep) { } result = calloc(1, sizeof(*result)); - result->data = strndup(path, ARG_MAX); + result->data = strdup(path); result->data_len = strlen(result->data) + 2; // + 2 to handle an empty PATH result->sep = strdup(sep); -- cgit