summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2012-10-31 20:05:31 +0000
committerwm4 <wm4@nowhere>2012-10-31 22:45:38 +0100
commit6c141b60b5609cf1a3ec9163039fe37a3825824e (patch)
tree187030e701f0467c0d255f689afff362b01f5242 /sub
parent86a5b7a4cc09b69eb108f8ef9fcb01811d7fa879 (diff)
downloadmpv-6c141b60b5609cf1a3ec9163039fe37a3825824e.tar.bz2
mpv-6c141b60b5609cf1a3ec9163039fe37a3825824e.tar.xz
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
Diffstat (limited to 'sub')
-rw-r--r--sub/subreader.c6
1 files changed, 4 insertions, 2 deletions
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;
}