[FFmpeg-cvslog] avio: Fix handling of filenames that contain :

Michael Niedermayer git at videolan.org
Thu Nov 24 15:14:05 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Nov 24 15:03:27 2011 +0100| [58030fc6c802d8cc45f114402ccb27be8c06f76b] | committer: Michael Niedermayer

avio: Fix handling of filenames that contain :

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=58030fc6c802d8cc45f114402ccb27be8c06f76b
---

 libavformat/avio.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index a9f4253..efe1c26 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -288,17 +288,17 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags,
 {
     URLProtocol *up = NULL;
     char proto_str[128], proto_nested[128], *ptr;
-    const char *proto_end = strchr(filename, ':');
+    size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
 
     if (!first_protocol) {
         av_log(NULL, AV_LOG_WARNING, "No URL Protocols are registered. "
                                      "Missing call to av_register_all()?\n");
     }
 
-    if (!proto_end || is_dos_path(filename))
+    if (filename[proto_len] != ':' &&  filename[proto_len] != ',' || is_dos_path(filename))
         strcpy(proto_str, "file");
     else
-        av_strlcpy(proto_str, filename, FFMIN(proto_end-filename+1, sizeof(proto_str)));
+        av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str)));
 
     if ((ptr = strchr(proto_str, ',')))
         *ptr = '\0';



More information about the ffmpeg-cvslog mailing list