From: Jérôme Decoodt Date: Tue, 15 Apr 2008 09:50:22 +0000 (+0200) Subject: Avoid segfaulting if live555 error is neither a HTTP or RTSP error X-Git-Tag: 0.9.0-test0~1482 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=96e4e5f43914820bd36c12e8532d5908d678e02d;p=vlc Avoid segfaulting if live555 error is neither a HTTP or RTSP error Avoid an infinite loop for this case too (only 3 tries to connect, then abort) --- diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp index 7360e3b776..1842f56708 100644 --- a/modules/demux/live555.cpp +++ b/modules/demux/live555.cpp @@ -486,7 +486,9 @@ static int Connect( demux_t *p_demux ) psz_pwd = var_CreateGetString( p_demux, "rtsp-pwd" ); } + int i_lefttries = 3; createnew: + i_lefttries--; if( p_demux->b_die || p_demux->b_error ) { free( psz_user ); @@ -546,7 +548,10 @@ describe: else { const char *psz_tmp = strstr( psz_error, "RTSP" ); - sscanf( psz_tmp, "RTSP/%*s%3u", &i_code ); + if( psz_tmp ) + sscanf( psz_tmp, "RTSP/%*s%3u", &i_code ); + else + i_code = 0; } msg_Dbg( p_demux, "DESCRIBE failed with %d: %s", i_code, psz_error ); @@ -593,7 +598,8 @@ describe: msg_Dbg( p_demux, "connection timeout, retrying" ); if( p_sys->rtsp ) RTSPClient::close( p_sys->rtsp ); p_sys->rtsp = NULL; - goto createnew; + if( i_lefttries > 0 ) + goto createnew; } i_ret = VLC_EGENERIC; }