comparison libass/ass.c @ 19612:dcd0f218008f

Bugfix: potential write of unallocated memory.
author eugeni
date Thu, 31 Aug 2006 22:45:20 +0000
parents 586e7d259d05
children 4a64fecfb425
comparison
equal deleted inserted replaced
19611:27c747718955 19612:dcd0f218008f
280 while (1) { 280 while (1) {
281 NEXT(q, tname); 281 NEXT(q, tname);
282 if (strcasecmp(tname, "Text") == 0) { 282 if (strcasecmp(tname, "Text") == 0) {
283 char* last; 283 char* last;
284 event->Text = strdup(p); 284 event->Text = strdup(p);
285 last = event->Text + strlen(event->Text) - 1; 285 if (*event->Text != 0) {
286 if (*last == '\r') 286 last = event->Text + strlen(event->Text) - 1;
287 *last = 0; 287 if (last >= event->Text && *last == '\r')
288 *last = 0;
289 }
288 mp_msg(MSGT_GLOBAL, MSGL_DBG2, "Text = %s\n", event->Text); 290 mp_msg(MSGT_GLOBAL, MSGL_DBG2, "Text = %s\n", event->Text);
289 event->Duration -= event->Start; 291 event->Duration -= event->Start;
290 free(format); 292 free(format);
291 return 0; // "Text" is always the last 293 return 0; // "Text" is always the last
292 } 294 }