[vlc-commits] vlc_path2_uri: fix off-by-one
Rémi Denis-Courmont
git at videolan.org
Tue Mar 31 20:25:02 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Mar 31 21:24:29 2015 +0300| [8a9fa0b92d89ff14606f9750e0f2261e28d3df3e] | committer: Rémi Denis-Courmont
vlc_path2_uri: fix off-by-one
Pointed-out-by: Zoran Turalija <zoran.turalija at gmail.com>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8a9fa0b92d89ff14606f9750e0f2261e28d3df3e
---
src/text/url.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/text/url.c b/src/text/url.c
index 38a7cc7..60b78c6 100644
--- a/src/text/url.c
+++ b/src/text/url.c
@@ -195,9 +195,8 @@ char *vlc_path2uri (const char *path, const char *scheme)
/* \\host\share\path -> file://host/share/path */
size_t hostlen = strcspn (path + 2, DIR_SEP);
- buf = malloc (7 + hostlen);
- if (buf != NULL)
- snprintf (buf, 7 + hostlen, "file://%s", path + 2);
+ if (asprintf (&buf, "file://%s", path + 2) == -1)
+ buf = NULL;
path += 2 + hostlen;
if (path[0] == '\0')
More information about the vlc-commits
mailing list