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

- Fix possible buffer overflow (?)

- Fix unitialised value

According to valgrind there's still an unitialized value at line 2343
parent b65b861a
...@@ -462,6 +462,7 @@ static char *FileToUrl( char *name, vlc_bool_t *pb_index ) ...@@ -462,6 +462,7 @@ static char *FileToUrl( char *name, vlc_bool_t *pb_index )
url = p = malloc( strlen( name ) + 1 ); url = p = malloc( strlen( name ) + 1 );
*pb_index = VLC_FALSE;
if( !url || !p ) if( !url || !p )
{ {
return NULL; return NULL;
...@@ -492,7 +493,6 @@ static char *FileToUrl( char *name, vlc_bool_t *pb_index ) ...@@ -492,7 +493,6 @@ static char *FileToUrl( char *name, vlc_bool_t *pb_index )
} }
#endif #endif
*pb_index = VLC_FALSE;
/* index.* -> / */ /* index.* -> / */
if( ( p = strrchr( url, '/' ) ) != NULL ) if( ( p = strrchr( url, '/' ) ) != NULL )
{ {
...@@ -2322,7 +2322,7 @@ static void MacroDo( httpd_file_sys_t *p_args, ...@@ -2322,7 +2322,7 @@ static void MacroDo( httpd_file_sys_t *p_args,
{ {
case MVLC_INT: case MVLC_INT:
i = config_GetInt( p_intf, m->param1 ); i = config_GetInt( p_intf, m->param1 );
sprintf( value, "%i", i ); sprintf( value, "%d", i );
break; break;
case MVLC_FLOAT: case MVLC_FLOAT:
f = config_GetFloat( p_intf, m->param1 ); f = config_GetFloat( p_intf, m->param1 );
...@@ -2330,13 +2330,15 @@ static void MacroDo( httpd_file_sys_t *p_args, ...@@ -2330,13 +2330,15 @@ static void MacroDo( httpd_file_sys_t *p_args,
break; break;
case MVLC_STRING: case MVLC_STRING:
psz = config_GetPsz( p_intf, m->param1 ); psz = config_GetPsz( p_intf, m->param1 );
sprintf( value, "%s", psz ? psz : "" ); snprintf( value, sizeof( value ), "%s", psz ? psz : "" );
if( psz ) free( psz ); if( psz ) free( psz );
break; break;
default: default:
sprintf( value, "invalid type(%s) in set", m->param2 ); snprintf( value, sizeof( value ),
"invalid type(%s) in set", m->param2 );
break; break;
} }
value[sizeof( value ) - 1] = '\0';
msg_Dbg( p_intf, "get name=%s value=%s type=%s", m->param1, value, m->param2 ); msg_Dbg( p_intf, "get name=%s value=%s type=%s", m->param1, value, m->param2 );
PRINTS( "%s", value ); PRINTS( "%s", value );
break; break;
......
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