changeset 34586:ebcc8c7e7fda

Prevent out-of-bounds array access of fsHistory.
author ib
date Thu, 09 Feb 2012 15:01:32 +0000
parents 60bf43f94f17
children ba16576126fa
files gui/cfg.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gui/cfg.c	Thu Feb 09 14:53:24 2012 +0000
+++ b/gui/cfg.c	Thu Feb 09 15:01:32 2012 +0000
@@ -27,6 +27,7 @@
 
 #include "config.h"
 #include "help_mp.h"
+#include "libavutil/common.h"
 #include "libmpcodecs/vd.h"
 #include "libmpdemux/demuxer.h"
 #include "libvo/video_out.h"
@@ -330,9 +331,10 @@
     file  = fopen(fname, "rt");
 
     if (file) {
-        int i = 0;
+        unsigned int i = 0;
 
         while (fgetstr(line, sizeof(line), file))
+            if (i < FF_ARRAY_ELEMS(fsHistory))
             fsHistory[i++] = gstrdup(line);
 
         fclose(file);