[vlc-devel] commit: Fix potential segfault (don't dereference strrchr directly) CID 35. ( Rémi Duraffort )

git version control git at videolan.org
Fri Oct 10 21:17:27 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Oct 10 21:08:33 2008 +0200| [74d28b3e26ca08b135ca868f221a2339070c6cd2] | committer: Rémi Duraffort 

Fix potential segfault (don't dereference strrchr directly) CID 35.

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

 modules/demux/playlist/sgimb.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/modules/demux/playlist/sgimb.c b/modules/demux/playlist/sgimb.c
index 878a41a..9fc898a 100644
--- a/modules/demux/playlist/sgimb.c
+++ b/modules/demux/playlist/sgimb.c
@@ -218,7 +218,10 @@ static int ParseLine ( demux_t *p_demux, char *psz_line )
         psz_bol += sizeof("Stream=\"") - 1;
         if ( !psz_bol )
             return 0;
-        strrchr( psz_bol, '"' )[0] = '\0';
+        char* psz_tmp = strrchr( psz_bol, '"' );
+        if( !psz_tmp )
+            return 0;
+        psz_tmp[0] = '\0';
         /* We cheat around xdma. for some reason xdma links work different then rtsp */
         if( !strncasecmp( psz_bol, "xdma://", sizeof("xdma://") - 1 ) )
         {




More information about the vlc-devel mailing list