[vlc-commits] vlc_path2uri: really fix off-by-one error

Rémi Denis-Courmont git at videolan.org
Wed Apr 1 18:49:48 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr  1 19:49:34 2015 +0300| [d2bb4d1b4e37f447f1f28c8eadf2944f30535e3a] | committer: Rémi Denis-Courmont

vlc_path2uri: really fix off-by-one error

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

 src/text/url.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/text/url.c b/src/text/url.c
index 60b78c6..f2d7fb9 100644
--- a/src/text/url.c
+++ b/src/text/url.c
@@ -193,9 +193,9 @@ char *vlc_path2uri (const char *path, const char *scheme)
     if (!strncmp (path, "\\\\", 2))
     {   /* Windows UNC paths */
         /* \\host\share\path -> file://host/share/path */
-        size_t hostlen = strcspn (path + 2, DIR_SEP);
+        int hostlen = strcspn (path + 2, DIR_SEP);
 
-        if (asprintf (&buf, "file://%s", path + 2) == -1)
+        if (asprintf (&buf, "file://%.*s", hostlen, path + 2) == -1)
             buf = NULL;
         path += 2 + hostlen;
 



More information about the vlc-commits mailing list