Commit ae2f5c6e authored by bellard's avatar bellard

avoid false URL protocol detection when using ':' in filenames


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@1595 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 815fabbc
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "avformat.h" #include "avformat.h"
#include <ctype.h>
URLProtocol *first_protocol = NULL; URLProtocol *first_protocol = NULL;
...@@ -41,12 +42,16 @@ int url_open(URLContext **puc, const char *filename, int flags) ...@@ -41,12 +42,16 @@ int url_open(URLContext **puc, const char *filename, int flags)
p = filename; p = filename;
q = proto_str; q = proto_str;
while (*p != '\0' && *p != ':') { while (*p != '\0' && *p != ':') {
/* protocols can only contain alphabetic chars */
if (!isalpha(*p))
goto file_proto;
if ((q - proto_str) < sizeof(proto_str) - 1) if ((q - proto_str) < sizeof(proto_str) - 1)
*q++ = *p; *q++ = *p;
p++; p++;
} }
/* if the protocol has length 1, we consider it is a dos drive */ /* if the protocol has length 1, we consider it is a dos drive */
if (*p == '\0' || (q - proto_str) <= 1) { if (*p == '\0' || (q - proto_str) <= 1) {
file_proto:
strcpy(proto_str, "file"); strcpy(proto_str, "file");
} else { } else {
*q = '\0'; *q = '\0';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment