[vlc-commits] input: stream: fix stack overflow in stream_UrlNew
Francois Cartegnie
git at videolan.org
Fri Feb 19 14:20:22 CET 2016
vlc/vlc-2.2 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Feb 19 12:29:41 2016 +0100| [5ba4a08b65e4221f01f577bd105bf50a6868e980] | committer: Jean-Baptiste Kempf
input: stream: fix stack overflow in stream_UrlNew
refs #16651
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=5ba4a08b65e4221f01f577bd105bf50a6868e980
---
src/input/stream.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/input/stream.c b/src/input/stream.c
index 4cceaac..13a0a01 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -252,7 +252,10 @@ stream_t *stream_UrlNew( vlc_object_t *p_parent, const char *psz_url )
if( !psz_url )
return NULL;
- char psz_dup[strlen( psz_url ) + 1];
+ char *psz_dup = malloc(strlen( psz_url ) + 1);
+ if( !psz_dup )
+ return NULL;
+
strcpy( psz_dup, psz_url );
input_SplitMRL( &psz_access, &psz_demux, &psz_path, &psz_anchor, psz_dup );
@@ -261,9 +264,12 @@ stream_t *stream_UrlNew( vlc_object_t *p_parent, const char *psz_url )
if( p_access == NULL )
{
msg_Err( p_parent, "no suitable access module for `%s'", psz_url );
+ free( psz_dup );
return NULL;
}
+ free( psz_dup );
+
return stream_AccessNew( p_access, NULL );
}
More information about the vlc-commits
mailing list