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

git version control git at videolan.org
Wed May 6 19:27:12 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May  6 19:15:50 2009 +0300| [981589fd461cfd201aaa13384e638303f6601098] | committer: Rémi Denis-Courmont 

Fix minor overflow bug

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

 src/config/file.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/config/file.c b/src/config/file.c
index db9baa9..85e3af8 100644
--- a/src/config/file.c
+++ b/src/config/file.c
@@ -422,7 +422,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
     module_t *p_parser;
     FILE *file;
     char p_line[1024], *p_index2;
-    int i_sizebuf = 0;
+    unsigned long i_sizebuf = 0;
     char *p_bigbuffer, *p_index;
     bool b_backup;
     int i_index;
@@ -444,6 +444,8 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
         fseek( file, 0L, SEEK_END );
         i_sizebuf = ftell( file );
         fseek( file, 0L, SEEK_SET );
+        if( i_sizebuf >= LONG_MAX )
+            i_sizebuf = 0;
     }
 
     p_bigbuffer = p_index = malloc( i_sizebuf+1 );




More information about the vlc-devel mailing list