]> git.sesse.net Git - vlc/commitdiff
* modules/demux/playlist/gvp.c: fixed segfault in detection code.
authorGildas Bazin <gbazin@videolan.org>
Fri, 6 Oct 2006 19:23:36 +0000 (19:23 +0000)
committerGildas Bazin <gbazin@videolan.org>
Fri, 6 Oct 2006 19:23:36 +0000 (19:23 +0000)
modules/demux/playlist/gvp.c

index 6b722745ab7adc042e35a7aba79f5d8dc18b2da3..6484a67b76bb9adfb0d30d8f00f028d92393b776 100644 (file)
@@ -77,14 +77,23 @@ static int Control( demux_t *p_demux, int i_query, va_list args );
 int E_(Import_GVP)( vlc_object_t *p_this )
 {
     demux_t *p_demux = (demux_t *)p_this;
+    int i_peek, i, b_found = VLC_FALSE;
     byte_t *p_peek;
 
-    stream_Peek( p_demux->s, &p_peek, MAX_LINE );
-    if( !strstr( p_peek, "gvp_version:" ) )
+    i_peek = stream_Peek( p_demux->s, &p_peek, MAX_LINE );
+
+    for( i = 0; i < i_peek - (int)sizeof("gvp_version:"); i++ )
     {
-        return VLC_EGENERIC;
+        if( p_peek[i] == 'g' && p_peek[i+1] == 'v' && p_peek[i+2] == 'p' &&
+            !memcmp( p_peek, "gvp_version:", sizeof("gvp_version:") - 1 ) )
+        {
+            b_found = VLC_TRUE;
+            break;
+        }
     }
 
+    if( !b_found ) return VLC_EGENERIC;
+
     STANDARD_DEMUX_INIT_MSG(  "using Google Video Playlist (gvp) import" )
     p_demux->pf_control = Control;
     p_demux->pf_demux = Demux;