]> git.sesse.net Git - vlc/commitdiff
Fix minor overflow bug
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 6 May 2009 16:15:50 +0000 (19:15 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 6 May 2009 16:15:50 +0000 (19:15 +0300)
src/config/file.c

index db9baa941911e740a39873474f392271a16c5cce..85e3af81e96c9780dbbdba331d72cf0ef8475d9d 100644 (file)
@@ -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 );