aboutsummaryrefslogtreecommitdiff
path: root/lib/cleanpath.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2021-05-06 16:49:09 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2021-05-06 16:49:09 -0400
commit41ba28892a04ab8a35a2751b4b7801414706f284 (patch)
treef914fca18ecc3bdb8211efeba9aff6bdec994892 /lib/cleanpath.c
parentc429ae2f0790c3486e7e420f4f2883c6a530ccf0 (diff)
downloadcleanpath-41ba28892a04ab8a35a2751b4b7801414706f284.tar.gz
Forget about ARG_MAX. The likelihood of accepting an unfathomably large input from the environment is pretty low
Diffstat (limited to 'lib/cleanpath.c')
-rw-r--r--lib/cleanpath.c14
1 files changed, 1 insertions, 13 deletions
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 <sys/limits.h>
-#endif // HAVE_SYS_LIMIT_H
-
-#if HAVE_LINUX_LIMIT_H
-#include <linux/limits.h>
-#endif // HAVE_LINUX_LIMIT_H
-#else
-#include <limits.h>
-#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);