From: Rémi Denis-Courmont Date: Wed, 5 Nov 2008 20:06:36 +0000 (+0200) Subject: Fix sscanf overflow X-Git-Tag: 1.0.0-pre1~2224 X-Git-Url: https://git.videolan.org/gitweb.cgi/vlc.git/?p=vlc.git;p=vlc.git;a=commitdiff_plain;h=4909d939d435d7930f0e05e8b308d735950368f8;hp=95491aa74fc33d7c3f5183e608ae0d057e1e3c5c Fix sscanf overflow Pointed-out-by: Tobias Klein --- diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c index 87a914c2dd..4df7ec09dd 100644 --- a/modules/demux/subtitle.c +++ b/modules/demux/subtitle.c @@ -1846,7 +1846,6 @@ static int ParseRealText( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx ) demux_sys_t *p_sys = p_demux->p_sys; text_t *txt = &p_sys->txt; char *psz_text = NULL; - char psz_end[12]= "", psz_begin[12] = ""; for( ;; ) { @@ -1867,13 +1866,14 @@ static int ParseRealText( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx ) char *psz_temp = strcasestr( s, "]%[^\n\r]", + "<%*[t|T]ime %*[b|B]egin=\"%11[^\"]\" %*[e|E]nd=\"%11[^\"]%*[^>]%[^\n\r]", psz_begin, psz_end, psz_text) != 3 ) && /* Line has begin and no end */ ( sscanf( psz_temp, - "<%*[t|T]ime %*[b|B]egin=\"%[^\"]\"%*[^>]%[^\n\r]", + "<%*[t|T]ime %*[b|B]egin=\"%11[^\"]\"%*[^>]%[^\n\r]", psz_begin, psz_text ) != 2) ) /* Line is not recognized */ {