]> git.sesse.net Git - vlc/commitdiff
Don't dereference strrchr without check (CID 185)
authorRémi Duraffort <ivoire@videolan.org>
Fri, 10 Oct 2008 19:27:43 +0000 (21:27 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Fri, 10 Oct 2008 19:32:30 +0000 (21:32 +0200)
modules/access/rtmp/access.c
modules/access_output/rtmp.c

index 0ada7a49c72c3c55b2a378a0c0e5653ce6db0f50..e0878779e75a6fc62d772b180b1b8d2e999b9e1f 100644 (file)
@@ -115,7 +115,10 @@ static int Open( vlc_object_t *p_this )
     }
 
     length_path = strlen( p_sys->p_thread->url.psz_path );
-    length_media_name = strlen( strrchr( p_sys->p_thread->url.psz_path, '/' ) ) - 1;
+    char* psz_tmp = strrchr( p_sys->p_thread->url.psz_path, '/' );
+    if( !psz_tmp )
+        goto error;
+    length_media_name = strlen( psz_tmp ) - 1;
 
     p_sys->p_thread->psz_application = strndup( p_sys->p_thread->url.psz_path + 1, length_path - length_media_name - 2 );
     p_sys->p_thread->psz_media = strdup( p_sys->p_thread->url.psz_path + ( length_path - length_media_name ) );
index 8ff62bc4a48986a76ae3d0f81a738997c0a86f4a..8f478f5a2c5c771ce9bf05cdce09c27e4f558499 100644 (file)
@@ -129,7 +129,10 @@ static int Open( vlc_object_t *p_this )
     }
 
     length_path = strlen( p_sys->p_thread->url.psz_path );
-    length_media_name = strlen( strrchr( p_sys->p_thread->url.psz_path, '/' ) ) - 1;
+    char* psz_tmp = strrchr( p_sys->p_thread->url.psz_path, '/' );
+    if( !psz_tmp )
+        goto error;
+    length_media_name = strlen( psz_tmp ) - 1;
 
     p_sys->p_thread->psz_application = strndup( p_sys->p_thread->url.psz_path + 1, length_path - length_media_name - 2 );
     p_sys->p_thread->psz_media = strdup( p_sys->p_thread->url.psz_path + ( length_path - length_media_name ) );