[vlc-commits] playlist: m3u: fix CheckContentType check.

Francois Cartegnie git at videolan.org
Tue Jun 19 13:46:15 CEST 2012


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jun 19 13:26:28 2012 +0200| [cd5c762f474c7a6f0a93e43b3d35ddb59cc5e623] | committer: Francois Cartegnie

playlist: m3u: fix CheckContentType check.

strncase cmp reports 0 if the tested size is 0.
Was always matching empty Content-Type then.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cd5c762f474c7a6f0a93e43b3d35ddb59cc5e623
---

 modules/demux/playlist/m3u.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c
index ad4b2e1..18e2fb5 100644
--- a/modules/demux/playlist/m3u.c
+++ b/modules/demux/playlist/m3u.c
@@ -133,7 +133,14 @@ static bool CheckContentType( stream_t * p_stream, const char * psz_ctype )
     char *psz_check = stream_ContentType( p_stream );
     if( !psz_check ) return false;
 
-    int i_res = strncasecmp( psz_check, psz_ctype, strlen( psz_check ) );
+    int i_len = strlen( psz_check );
+    if ( i_len == 0 )
+    {
+        free( psz_check );
+        return false;
+    }
+
+    int i_res = strncasecmp( psz_check, psz_ctype, i_len );
     free( psz_check );
 
     return ( i_res == 0 ) ? true : false;



More information about the vlc-commits mailing list