From 9542056547355bd24fa03fac4c26176caddeb2ce Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 4 Oct 2010 13:41:09 -0500 Subject: [PATCH] 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. --- src/as/asLibRoutines.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/as/asLibRoutines.c b/src/as/asLibRoutines.c index bf1f59213..2a5c0d798 100644 --- a/src/as/asLibRoutines.c +++ b/src/as/asLibRoutines.c @@ -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);