From: Rafaël Carré Date: Thu, 5 Oct 2006 16:08:45 +0000 (+0000) Subject: Fix stack corruption in httpd X-Git-Tag: 0.9.0-test0~10041 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=6941f189136416a775b3636ed3970fd53498947d;p=vlc Fix stack corruption in httpd --- diff --git a/modules/control/http/http.c b/modules/control/http/http.c index 094f9f4d5c..b587352f0b 100644 --- a/modules/control/http/http.c +++ b/modules/control/http/http.c @@ -124,7 +124,7 @@ static int Open( vlc_object_t *p_this ) *psz_crl = NULL; int i_port = 0; char *psz_src; - char psz_tmp[10]; + char *psz_tmp; var_Create(p_intf->p_libvlc_global, "http-host", VLC_VAR_STRING ); psz_address=var_GetString(p_intf->p_libvlc_global, "http-host"); @@ -263,9 +263,14 @@ static int Open( vlc_object_t *p_this ) i_port= 8080; } + /* maximum port is 65535 , strlen("65535") == 5 */ + psz_tmp = malloc( ( strlen( psz_address ) + 5 ) * sizeof( char) ); + /* Ugly hack to allow to run several HTTP servers on different ports. */ + sprintf( psz_tmp, "%s:%d", psz_address, i_port + 1 ); var_SetString( p_intf->p_libvlc_global, "http-host", psz_tmp ); + free( psz_tmp ); msg_Dbg( p_intf, "base %s:%d", psz_address, i_port );