From 6c141b60b5609cf1a3ec9163039fe37a3825824e Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 31 Oct 2012 20:05:31 +0000 Subject: subreader: do not write outside array bounds Extra checks to ensure we really do not write outside array bounds. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35313 b3059339-0415-0410-9bf9-f77b7e298cf2 --- sub/subreader.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sub') diff --git a/sub/subreader.c b/sub/subreader.c index 2ecc41c346..1f88b220d1 100644 --- a/sub/subreader.c +++ b/sub/subreader.c @@ -1106,9 +1106,11 @@ static subtitle *sub_read_line_jacosub(stream_t* st, subtitle * current, } //-- 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; } -- cgit v1.2.3