Commit 96a6323f authored by Laurent Aimar's avatar Laurent Aimar

Fixed buffer overread in equalizer BandCallback.

parent 36d1d663
...@@ -546,29 +546,33 @@ static int BandsCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -546,29 +546,33 @@ static int BandsCallback( vlc_object_t *p_this, char const *psz_cmd,
VLC_UNUSED(p_this); VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_this); VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval);
aout_filter_sys_t *p_sys = (aout_filter_sys_t *)p_data; aout_filter_sys_t *p_sys = (aout_filter_sys_t *)p_data;
char *psz_bands = newval.psz_string; char *psz_bands = newval.psz_string;
char *psz_next;
char *p = psz_bands;
int i;
/* Same thing for bands */ /* Same thing for bands */
if( *psz_bands ) for( i = 0; i < p_sys->i_band; i++ )
{ {
char *p = psz_bands, *p_next; float f;
int i;
for( i = 0; i < p_sys->i_band; i++ ) if( *psz_bands == '\0' )
{ break;
/* Read dB -20/20 */
/* Read dB -20/20 */
#ifdef HAVE_STRTOF #ifdef HAVE_STRTOF
float f = strtof( p, &p_next ); f = strtof( p, &psz_next );
#else #else
float f = (float) strtod( p, &p_next ); f = (float)strtod( p, &psz_next );
#endif #endif
if( !p_next || p_next == p ) break; /* strtof() failed */ if( psz_next == p )
break; /* no conversion */
p_sys->f_amp[i] = EqzConvertdB( f ); p_sys->f_amp[i] = EqzConvertdB( f );
if( !*p ) break; /* end of line */ if( *psz_next == '\0' )
p=p_next+1; break; /* end of line */
} p = &psz_next[1];
} }
return VLC_SUCCESS; return 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