[vlc-commits] url: refuse to translate path "" to URL (fixes #21962)

Rémi Denis-Courmont git at videolan.org
Sun Feb 24 17:45:54 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 24 18:42:27 2019 +0200| [4986985658009a0fc090a50ee4759507670cee55] | committer: Rémi Denis-Courmont

url: refuse to translate path "" to URL (fixes #21962)

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

 src/test/url.c | 2 +-
 src/text/url.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/test/url.c b/src/test/url.c
index b9a827512b..9db8392471 100644
--- a/src/test/url.c
+++ b/src/test/url.c
@@ -184,6 +184,7 @@ int main (void)
     test_b64 ("foobar", "Zm9vYmFy");
 
     /* Path test */
+    test_path("", NULL);
 #ifndef _WIN32
     test_path ("/", "file:///");
     test_path ("/home/john/", "file:///home/john/");
@@ -219,7 +220,6 @@ int main (void)
 
     test_current_directory_path ("movie.ogg", tmpdir, "movie.ogg");
     test_current_directory_path (".", tmpdir, ".");
-    test_current_directory_path ("", tmpdir, "");
 #endif
 
     /*val = fchdir (fd);
diff --git a/src/text/url.c b/src/text/url.c
index cc83c16a68..0c15a9bcb7 100644
--- a/src/text/url.c
+++ b/src/text/url.c
@@ -198,6 +198,8 @@ char *vlc_path2uri (const char *path, const char *scheme)
     {   /* Relative path: prepend the current working directory */
         char *cwd, *ret;
 
+        if (path[0] == '\0')
+            return NULL;
         if ((cwd = vlc_getcwd ()) == NULL)
             return NULL;
         if (asprintf (&buf, "%s"DIR_SEP"%s", cwd, path) == -1)



More information about the vlc-commits mailing list