Bugfix: potential write of unallocated memory.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19618 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
eugeni 2006-08-31 22:45:20 +00:00
parent b792548aa7
commit 534fe740f5
1 changed files with 5 additions and 3 deletions

View File

@ -282,9 +282,11 @@ static int process_event_tail(ass_track_t* track, ass_event_t* event, char* str,
if (strcasecmp(tname, "Text") == 0) {
char* last;
event->Text = strdup(p);
if (*event->Text != 0) {
last = event->Text + strlen(event->Text) - 1;
if (*last == '\r')
if (last >= event->Text && *last == '\r')
*last = 0;
}
mp_msg(MSGT_GLOBAL, MSGL_DBG2, "Text = %s\n", event->Text);
event->Duration -= event->Start;
free(format);