summaryrefslogtreecommitdiffstats
path: root/subreader.c
diff options
context:
space:
mode:
authorgabucino <gabucino@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-04-01 19:35:18 +0000
committergabucino <gabucino@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-04-01 19:35:18 +0000
commitb4535b006973da5ad17654bb9212c8db6c9b96ec (patch)
tree3ff34320ea5fb74095f140d05c1f934036c25424 /subreader.c
parent348e8653998f3be7110a4a36ae7cac5ed6eff3d3 (diff)
downloadmpv-b4535b006973da5ad17654bb9212c8db6c9b96ec.tar.bz2
mpv-b4535b006973da5ad17654bb9212c8db6c9b96ec.tar.xz
no more garbage! (fixed by laaz)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@271 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'subreader.c')
-rw-r--r--subreader.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/subreader.c b/subreader.c
index 3f412b8f1f..48da79e200 100644
--- a/subreader.c
+++ b/subreader.c
@@ -61,9 +61,9 @@ subtitle *sub_read_line_microdvd(FILE *fd,subtitle *current) {
next=p, i=0;
while ((next =sub_readtext (next, &(current->text[i])))) {
- if (current->text[i]==ERR || current->text[i]==ERR) {return ERR;}
+ if (current->text[i]==ERR) {return ERR;}
i++;
- if (i>SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");return ERR;}
+ if (i>SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return;}
}
current->lines=i+1;
@@ -92,6 +92,7 @@ subtitle *sub_read_line_subrip(FILE *fd, subtitle *current) {
current->text[current->lines-1]=(char *)malloc (len+1);
if (!current->text[current->lines-1]) return ERR;
strncpy (current->text[current->lines-1], q, len);
+ current->text[current->lines-1][len]='\0';
if (!*p || *p=='\r' || *p=='\n') break;
while (*p++!=']');
}
@@ -120,7 +121,7 @@ subtitle *sub_read_line_third(FILE *fd,subtitle *current) {
if (len) {
current->text[i]=(char *)malloc (len+1);
if (!current->text[i]) return ERR;
- strncpy (current->text[i], line, len);
+ strncpy (current->text[i], line, len); current->text[i][len]='\0';
i++;
} else {
break;