[vlc-devel] commit: Fix sscanf overflow ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed Nov 5 21:38:15 CET 2008


vlc | branch: 0.9-bugfix | Rémi Denis-Courmont <rdenis at simphalempin.com> | Wed Nov  5 22:04:56 2008 +0200| [e3cef651125701a2e33a8d75b815b3e39681a447] | committer: Rémi Denis-Courmont 

Fix sscanf overflow

Pointed-out-by: Tobias Klein <tk at trapkit.de>

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

 modules/demux/subtitle.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index 730d3bc..0909832 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -1842,7 +1842,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( ;; )
     {
@@ -1863,13 +1862,14 @@ static int ParseRealText( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
         char *psz_temp = strcasestr( s, "<time");
         if( psz_temp != NULL )
         {
+            char psz_end[12], psz_begin[12];
             /* Line has begin and end */
             if( ( sscanf( psz_temp,
-                  "<%*[t|T]ime %*[b|B]egin=\"%[^\"]\" %*[e|E]nd=\"%[^\"]%*[^>]%[^\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 */
             {




More information about the vlc-devel mailing list