Commit 8cce5134 authored by dionoea's avatar dionoea

Prevent setting volume to outrageous values.

parent 11de24df
...@@ -53,8 +53,8 @@ ...@@ -53,8 +53,8 @@
static int vlclua_volume_set( lua_State *L ) static int vlclua_volume_set( lua_State *L )
{ {
playlist_t *p_this = vlclua_get_playlist_internal( L ); playlist_t *p_this = vlclua_get_playlist_internal( L );
int i_volume = luaL_checkint( L, 1 ); int i_volume = __MAX(__MIN(luaL_checkint( L, 1 ), AOUT_VOLUME_MAX),
/* Do we need to check that i_volume is in the AOUT_VOLUME_MIN->MAX range?*/ AOUT_VOLUME_MIN);
int i_ret = aout_VolumeSet( p_this, i_volume ); int i_ret = aout_VolumeSet( p_this, i_volume );
vlclua_release_playlist_internal( p_this ); vlclua_release_playlist_internal( p_this );
return vlclua_push_ret( L, i_ret ); return vlclua_push_ret( L, i_ret );
......
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