summaryrefslogtreecommitdiff
path: root/libavformat/avio.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2003-02-21 11:08:08 +0000
committerFabrice Bellard <fabrice@bellard.org>2003-02-21 11:08:08 +0000
commit5d5fef0af19156972a8283baa8e7970df3199f46 (patch)
tree35dbb54b953208fc80ec385dd86bde878158b696 /libavformat/avio.c
parentb2a3fcb7e144d42a55f14df6d10f167f0f79fb8b (diff)
avoid false URL protocol detection when using ':' in filenames
Originally committed as revision 1595 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/avio.c')
-rw-r--r--libavformat/avio.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c
index ac041a38cd..3cd9e4d991 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -17,6 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "avformat.h"
+#include <ctype.h>
URLProtocol *first_protocol = NULL;
@@ -41,12 +42,16 @@ int url_open(URLContext **puc, const char *filename, int flags)
p = filename;
q = proto_str;
while (*p != '\0' && *p != ':') {
+ /* protocols can only contain alphabetic chars */
+ if (!isalpha(*p))
+ goto file_proto;
if ((q - proto_str) < sizeof(proto_str) - 1)
*q++ = *p;
p++;
}
/* if the protocol has length 1, we consider it is a dos drive */
if (*p == '\0' || (q - proto_str) <= 1) {
+ file_proto:
strcpy(proto_str, "file");
} else {
*q = '\0';