[vlc-commits] ftp: do not include . and .. in directory listing

Rémi Denis-Courmont git at videolan.org
Sun Jan 10 12:50:53 UTC 2021


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jan 10 14:04:14 2021 +0200| [6c1b2cfffd4eabad741fd8400e671ea1421aaf90] | committer: Rémi Denis-Courmont

ftp: do not include . and .. in directory listing

This causes obvious serious problems with recursion.

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

 modules/access/ftp.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/modules/access/ftp.c b/modules/access/ftp.c
index 9c79084e62..d38815f782 100644
--- a/modules/access/ftp.c
+++ b/modules/access/ftp.c
@@ -956,6 +956,13 @@ static int DirRead (stream_t *p_access, input_item_node_t *p_current_node)
         else
             psz_file = psz_line;
 
+        /* Exclude this and parent directory */
+        if (strcmp(psz_file, ".") == 0 || strcmp(psz_file, "..") == 0)
+        {
+            free(psz_line);
+            continue;
+        }
+
         char *psz_filename = vlc_uri_encode( psz_file );
 
         if (unlikely(psz_filename == NULL))



More information about the vlc-commits mailing list