subreader: fix one more unsafe sscanf call with "%["

"%[,.:]" conversion was used with a buffer that could be shorter than
the matched string. Suppress assignment of the conversion since the
value wasn't used anyway, and also limit match length to 1 as it
doesn't look like the intent was to match longer runs of the
characters.

Merged from mplayer2 commit 5cb9aac. Note that the other half of the
mplayer2 commit is already part of the mpv commit d98e61e. (I'm not
sure why. The mplayer2 commit date precedes mpv's, but was pushed long
after the mpv change was pushed; either one of the dates is wrong, or
we did the same work twice - in that case, thanks a lot...)
This commit is contained in:
Uoti Urpala 2013-04-20 23:44:45 +03:00 committed by wm4
parent 5e727c314e
commit 2cd1a8286b
1 changed files with 1 additions and 1 deletions

View File

@ -1074,7 +1074,7 @@ static int sub_autodetect (stream_t* st, int *uses_time, int utf16) {
{*uses_time=1;return SUB_MPL2;}
if (sscanf (line, "%d:%d:%d.%d,%d:%d:%d.%d", &i, &i, &i, &i, &i, &i, &i, &i)==8)
{*uses_time=1;return SUB_SUBRIP;}
if (sscanf (line, "%d:%d:%d%[,.:]%d --> %d:%d:%d%[,.:]%d", &i, &i, &i, (char *)&i, &i, &i, &i, &i, (char *)&i, &i)==10)
if (sscanf (line, "%d:%d:%d%*1[,.:]%d --> %d:%d:%d%*1[,.:]%d", &i, &i, &i, &i, &i, &i, &i, &i) == 8)
{*uses_time=1;return SUB_SUBVIEWER;}
if (sscanf (line, "{T %d:%d:%d:%d",&i, &i, &i, &i)==4)
{*uses_time=1;return SUB_SUBVIEWER2;}