as: No need to limit CALC expression lengths.

We allocate a new postfix buffer for each expression, so there is no
need to limit the expression length, just allocate a buffer big enough
for the expression given.
This commit is contained in:
Andrew Johnson
2010-10-04 13:41:09 -05:00
parent 6d1cc23a7e
commit 9542056547

View File

@@ -1323,17 +1323,10 @@ static long asAsgRuleCalc(ASGRULE *pasgrule,const char *calc)
unsigned long stores;
if (!pasgrule) return 0;
insize = strlen(calc);
if (insize > MAX_INFIX_SIZE) {
pasgrule->calc = NULL;
pasgrule->rpcl = NULL;
status = S_asLib_badCalc;
errlogPrintf("CALC expression too long: '%s'\n", calc);
return status;
}
pasgrule->calc = asCalloc(1, insize+1);
insize = strlen(calc) + 1;
pasgrule->calc = asCalloc(1, insize);
strcpy(pasgrule->calc, calc);
pasgrule->rpcl = asCalloc(1, MAX_POSTFIX_SIZE);
pasgrule->rpcl = asCalloc(1, INFIX_TO_POSTFIX_SIZE(insize));
status = postfix(pasgrule->calc, pasgrule->rpcl, &err);
if(status) {
free((void *)pasgrule->calc);