parser/inpgmod.c, fix an almost bug, (level=...)
When 'level' is a valid model parameter, then it was processed like any other parameter, but additionally the `if (strcmp(parm, "level") == 0)' invoked INPgetValue() a second time. This special processing is meant to allow "level" for all models whether they make use of it or not. The excess invocation of INPgetValue() didn't cause harm, merely because the next token after the "level=number" almost necessarily is a string (the beginning "name=" of the next assignment) thus not a parse-able number, thus the second INPgetValue() didn't modify the 'line' pointer. To sanitise the code invoke the "level" skipping only if "level" is not recognised as a valid model parameter.
This commit is contained in:
parent
668123ae44
commit
aa27c8969c
|
|
@ -105,7 +105,7 @@ create_model(CKTcircuit *ckt, INPmodel *modtmp, INPtables *tab)
|
|||
}
|
||||
}
|
||||
|
||||
if (strcmp(parm, "level") == 0) {
|
||||
if (j >= *(ft_sim->devices[modtmp->INPmodType]->numModelParms) && strcmp(parm, "level") == 0) {
|
||||
/* just grab the level number and throw away */
|
||||
/* since we already have that info from pass1 */
|
||||
val = INPgetValue(ckt, &line, IF_REAL, tab);
|
||||
|
|
|
|||
Loading…
Reference in New Issue