From 64220f44562b9338084042b862ed86440fd75b7a Mon Sep 17 00:00:00 2001 From: Gildas Bazin Date: Fri, 6 Oct 2006 19:23:36 +0000 Subject: [PATCH] * modules/demux/playlist/gvp.c: fixed segfault in detection code. --- modules/demux/playlist/gvp.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/demux/playlist/gvp.c b/modules/demux/playlist/gvp.c index 6b722745ab..6484a67b76 100644 --- a/modules/demux/playlist/gvp.c +++ b/modules/demux/playlist/gvp.c @@ -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; -- 2.39.2