Prevent a crash in case of incomplete stoks[]

This commit is contained in:
Holger Vogt 2025-01-26 17:05:04 +01:00
parent 666e0dfcee
commit d71794bdbe
1 changed files with 5 additions and 0 deletions

View File

@ -1373,12 +1373,17 @@ struct card *pspice_compat(struct card *oldcard)
for (i = 0; i < 6; i++) {
stoks[i] = gettok_node(&cut_line);
if (!stoks[i]) {
int ii;
fprintf(stderr,
"Error: bad syntax in line %d\n %s\n"
"from file\n"
" %s\n",
card->linenum_orig, card->line, card->linesource);
good = FALSE;
/* null the rest of stoks */
for (ii = i + 1; ii < 6; ii++) {
stoks[ii] = NULL;
}
break;
}
}