[MPlayer-dev-eng] [PATCH] reject invalid protocols

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Dec 3 23:00:59 CET 2006


Hello,
currently something like
mplayer blubb://file.avi
will play file.avi instead of giving an error.
Is it okay to apply attached patch?
It means you can't play directly a file containing "://" in the filename
(though you can still use file://... to play it).

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: stream/stream.c
===================================================================
--- stream/stream.c	(revision 21478)
+++ stream/stream.c	(working copy)
@@ -213,7 +213,8 @@
     for(j = 0 ; sinfo->protocols[j] ; j++) {
       l = strlen(sinfo->protocols[j]);
       // l == 0 => Don't do protocol matching (ie network and filenames)
-      if((l == 0) || ((strncmp(sinfo->protocols[j],filename,l) == 0) &&
+      if((l == 0 && !strstr(filename, "://")) ||
+         ((strncmp(sinfo->protocols[j],filename,l) == 0) &&
 		      (strncmp("://",filename+l,3) == 0))) {
 	*file_format = DEMUXER_TYPE_UNKNOWN;
 	s = open_stream_plugin(sinfo,filename,mode,options,file_format,&r);


More information about the MPlayer-dev-eng mailing list