]> git.sesse.net Git - vlc/commitdiff
Fix impossible out-of-bound strcmp
authorRémi Denis-Courmont <rem@videolan.org>
Mon, 5 Feb 2007 16:49:14 +0000 (16:49 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Mon, 5 Feb 2007 16:49:14 +0000 (16:49 +0000)
modules/access/udp.c

index 19e4d60c44cfe715d54587914b44a9875658530b..9e6e6f858fcd1bd6de3f3d72cb967c85e6c0fc96 100644 (file)
@@ -136,7 +136,8 @@ static int Open( vlc_object_t *p_this )
     int  i_bind_port, i_server_port = 0;
     int fam = AF_UNSPEC, proto = IPPROTO_UDP, cscov = 8;
 
-    if (strlen (p_access->psz_access) >= 4)
+    if (strlen (p_access->psz_access) >= 3)
+    {
         switch (p_access->psz_access[3])
         {
             case '4':
@@ -147,9 +148,10 @@ static int Open( vlc_object_t *p_this )
                 fam = AF_INET6;
                 break;
         }
-    if (strcmp (p_access->psz_access + 3, "lite") == 0)
-        proto = IPPROTO_UDPLITE;
-    if (strncmp (p_access->psz_access, "rtp", 3) == 0)
+        if (strcmp (p_access->psz_access + 3, "lite") == 0)
+            proto = IPPROTO_UDPLITE;
+   }
+   if (strncmp (p_access->psz_access, "rtp", 3) == 0)
         /* Checksum coverage: RTP header is AT LEAST 12 bytes
          * in addition to UDP header (8 bytes) */
         cscov += 12;