[FFmpeg-devel] [PATCH] av_url_split: dont let '/' char whallop '?' char

Peter Ross pross at xvid.org
Sun Jul 22 12:51:53 CEST 2012


---
This allows '/' characters to occur after '?' in the URLI, e.g.
    tls://192.168.1.101:4172?listen&cert=/path/to/cert

 libavformat/utils.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 39527a6..637123d 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4058,7 +4058,7 @@ void av_url_split(char *proto, int proto_size,
                   char *path, int path_size,
                   const char *url)
 {
-    const char *p, *ls, *at, *col, *brk;
+    const char *p, *ls, *ls2, *at, *col, *brk;
 
     if (port_ptr)               *port_ptr = -1;
     if (proto_size > 0)         proto[0] = 0;
@@ -4080,8 +4080,11 @@ void av_url_split(char *proto, int proto_size,
 
     /* separate path from hostname */
     ls = strchr(p, '/');
+    ls2 = strchr(p, '?');
     if(!ls)
-        ls = strchr(p, '?');
+        ls = ls2;
+    else if (ls && ls2)
+        ls = FFMIN(ls, ls2);
     if(ls)
         av_strlcpy(path, ls, path_size);
     else
-- 
1.7.10.4

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120722/407c3d15/attachment.asc>


More information about the ffmpeg-devel mailing list