changeset 67:22e4d9d88e25 libavformat

avoid false URL protocol detection when using ':' in filenames
author bellard
date Fri, 21 Feb 2003 11:08:08 +0000
parents ad9bcf041e8e
children 1e2f55eced38
files avio.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/avio.c	Thu Feb 13 00:28:36 2003 +0000
+++ b/avio.c	Fri Feb 21 11:08:08 2003 +0000
@@ -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 @@
     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';