From 756e36be09728cceb6e509f68d52c1b3c33e0cb9 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 31 Oct 2012 20:05:31 +0000 Subject: [PATCH] subreader: jacosub: fix possibly writing one line too many git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35313 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix typo that might have caused reading beyond the string end. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35326 b3059339-0415-0410-9bf9-f77b7e298cf2 --- sub/subreader.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sub/subreader.c b/sub/subreader.c index 68c4ecbaf3..5ef039234d 100644 --- a/sub/subreader.c +++ b/sub/subreader.c @@ -163,7 +163,7 @@ static subtitle *sub_read_line_sami(stream_t* st, subtitle *current, s++; if (*s == 'P' || *s == 'p') { s++; state = 2; continue; } /* found ' TAG */ - if (s == '\0') + if (*s == '\0') break; s++; continue; @@ -1131,9 +1131,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; } -- 2.11.4.GIT