changeset 35219:f46a80e9fe77

Extra checks to ensure we really do not write outside array bounds.
author reimar
date Wed, 31 Oct 2012 20:05:31 +0000
parents 03021b062140
children 349f03d4c033
files sub/subreader.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sub/subreader.c	Wed Oct 31 19:50:11 2012 +0000
+++ b/sub/subreader.c	Wed Oct 31 20:05:31 2012 +0000
@@ -1097,9 +1097,11 @@
 	    }			//-- switch
 	}			//-- for
 	*q = '\0';
-	current->text[current->lines] = strdup(line1);
+	if (current->lines < SUB_MAX_TEXT)
+	    current->text[current->lines] = strdup(line1);
     }				//-- while
-    current->lines++;
+    if (current->lines < SUB_MAX_TEXT)
+        current->lines++;
     return current;
 }