Commit d839410a authored by flx42's avatar flx42 Committed by Ilkka Ollakka
Browse files

Subtitle: fix off-by-one error during allocation before call to sscanf



Fix a crash when parsing subtitles. From the man page of sscanf:
"the next pointer must be a pointer to character array that is long
enough to hold the input sequence and the terminating null byte"
Signed-off-by: Ilkka Ollakka's avatarIlkka Ollakka <ileoo@videolan.org>
parent 5c0a6cab
......@@ -1012,8 +1012,8 @@ static int subtitle_ParseSubRipTiming( subtitle_t *p_subtitle,
{
int i_result = VLC_EGENERIC;
char *psz_start, *psz_stop;
psz_start = malloc( strlen(s) );
psz_stop = malloc( strlen(s) );
psz_start = malloc( strlen(s) + 1 );
psz_stop = malloc( strlen(s) + 1 );
if( sscanf( s, "%s --> %s", psz_start, psz_stop) == 2 &&
subtitle_ParseSubRipTimingValue( &p_subtitle->i_start, psz_start ) == VLC_SUCCESS &&
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment