Missing check in setGlobalVariable(...)

This commit is contained in:
bsongis
2014-05-05 14:51:22 +02:00
parent c53fbd9e94
commit 6ae7da4b1a
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -758,7 +758,7 @@ static int luaModelSetGlobalVariable(lua_State *L)
int idx = luaL_checkunsigned(L, 1);
int phase = luaL_checkunsigned(L, 2);
int value = luaL_checkinteger(L, 3);
if (phase < MAX_PHASES && idx < MAX_GVARS && value <= 500) {
if (phase < MAX_PHASES && idx < MAX_GVARS && value >= -GVAR_LIMIT && value <= GVAR_LIMIT) {
g_model.phaseData[phase].gvars[idx] = value;
}
return 0;
+1 -1
View File
@@ -916,7 +916,7 @@ PACK(typedef struct t_CustomFnData { // Function Switches data
#define CFN_GVAR_MODE(p) ((p)->all.mode)
#define CFN_PARAM(p) ((p)->all.val)
#define CFN_RESET(p) ((p)->active=0, (p)->clear.val1=0, (p)->clear.val2=0)
#define CFN_GVAR_CST_MAX 500
#define CFN_GVAR_CST_MAX GVAR_LIMIT
#else
PACK(typedef struct t_CustomFnData {
PACK(union {