# HG changeset patch # User gabucino # Date 986153718 0 # Node ID 7d544020e398b1f12e4bd3a6d05affcc6f1ad61b # Parent f5a7323af43f6976773d91e63628387da3b8d7a5 no more garbage! (fixed by laaz) diff -r f5a7323af43f -r 7d544020e398 subreader.c --- a/subreader.c Sun Apr 01 17:50:40 2001 +0000 +++ b/subreader.c Sun Apr 01 19:35:18 2001 +0000 @@ -61,9 +61,9 @@ 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 @@ 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 @@ 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;