[vlc-devel] commit: Don't dereference strrchr without check (CID 185) ( Rémi Duraffort )
git version control
git at videolan.org
Fri Oct 10 21:49:45 CEST 2008
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Oct 10 21:27:43 2008 +0200| [eeaa54cf2c5d1dca043b6d655d5786d138b83503] | committer: Rémi Duraffort
Don't dereference strrchr without check (CID 185)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eeaa54cf2c5d1dca043b6d655d5786d138b83503
---
modules/access/rtmp/access.c | 5 ++++-
modules/access_output/rtmp.c | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/access/rtmp/access.c b/modules/access/rtmp/access.c
index 0ada7a4..e087877 100644
--- a/modules/access/rtmp/access.c
+++ b/modules/access/rtmp/access.c
@@ -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 ) );
diff --git a/modules/access_output/rtmp.c b/modules/access_output/rtmp.c
index 8ff62bc..8f478f5 100644
--- a/modules/access_output/rtmp.c
+++ b/modules/access_output/rtmp.c
@@ -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 ) );
More information about the vlc-devel
mailing list