[vlc-commits] directory: remove PATH_MAX limit (fixes #24754)

Rémi Denis-Courmont git at videolan.org
Sat Jun 6 08:09:39 CEST 2020


vlc/vlc-3.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May 20 18:37:17 2020 +0300| [a7ebe225d6b0f62054a1144631ab6040ea199b0a] | committer: Rémi Denis-Courmont

directory: remove PATH_MAX limit (fixes #24754)

(cherry picked from commit 1e23e470e7d59e0376ba861fb83e5c0c92a40de2)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=a7ebe225d6b0f62054a1144631ab6040ea199b0a
---

 modules/access/directory.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/access/directory.c b/modules/access/directory.c
index b7500c1f6b..5011424edd 100644
--- a/modules/access/directory.c
+++ b/modules/access/directory.c
@@ -136,10 +136,10 @@ int DirRead (stream_t *access, input_item_node_t *node)
         if (fstatat(dirfd(sys->dir), entry, &st, 0))
             continue;
 #else
-        char path[PATH_MAX];
+        char *path;
 
-        if (snprintf(path, PATH_MAX, "%s"DIR_SEP"%s", access->psz_filepath,
-                     entry) >= PATH_MAX || vlc_stat(path, &st))
+        if (asprintf(&path, "%s"DIR_SEP"%s", access->psz_filepath, entry) == -1
+         || (type = vlc_stat(path, &st), free(path), type))
             continue;
 #endif
         switch (st.st_mode & S_IFMT)



More information about the vlc-commits mailing list