Commit abc867ad authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

input: fix stack overflow if user feeds an overly large MRL

(cherry picked from commit a276d9aa)

Conflicts:

	src/input/input.c
parent 4d3f5285
...@@ -2063,8 +2063,6 @@ static int InputSourceInit( input_thread_t *p_input, ...@@ -2063,8 +2063,6 @@ static int InputSourceInit( input_thread_t *p_input,
const char *psz_forced_demux ) const char *psz_forced_demux )
{ {
const bool b_master = in == &p_input->p->input; const bool b_master = in == &p_input->p->input;
char psz_dup[strlen (psz_mrl) + 1];
const char *psz_access; const char *psz_access;
const char *psz_demux; const char *psz_demux;
char *psz_path; char *psz_path;
...@@ -2073,11 +2071,14 @@ static int InputSourceInit( input_thread_t *p_input, ...@@ -2073,11 +2071,14 @@ static int InputSourceInit( input_thread_t *p_input,
vlc_value_t val; vlc_value_t val;
double f_fps; double f_fps;
strcpy( psz_dup, psz_mrl );
if( !in ) return VLC_EGENERIC; if( !in ) return VLC_EGENERIC;
if( !p_input ) return VLC_EGENERIC; if( !p_input ) return VLC_EGENERIC;
char *psz_dup = strdup( psz_mrl );
if( psz_dup == NULL )
goto error;
/* Split uri */ /* Split uri */
input_SplitMRL( &psz_access, &psz_demux, &psz_path, psz_dup ); input_SplitMRL( &psz_access, &psz_demux, &psz_path, psz_dup );
...@@ -2328,6 +2329,8 @@ static int InputSourceInit( input_thread_t *p_input, ...@@ -2328,6 +2329,8 @@ static int InputSourceInit( input_thread_t *p_input,
} }
} }
free( psz_dup );
/* get attachment /* get attachment
* FIXME improve for b_preparsing: move it after GET_META and check psz_arturl */ * FIXME improve for b_preparsing: move it after GET_META and check psz_arturl */
if( 1 || !p_input->b_preparsing ) if( 1 || !p_input->b_preparsing )
...@@ -2367,6 +2370,7 @@ error: ...@@ -2367,6 +2370,7 @@ error:
if( in->p_access ) if( in->p_access )
access_Delete( in->p_access ); access_Delete( in->p_access );
free( psz_dup );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
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