From b24c613ce68769a05b710ba65783f61e22828248 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Wed, 17 May 2023 10:08:38 +0200 Subject: [PATCH] Safeguard against bad arguments (no crash upon NULL) --- src/spicelib/parser/inpptree.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/spicelib/parser/inpptree.c b/src/spicelib/parser/inpptree.c index 4828c8fd4..398771048 100644 --- a/src/spicelib/parser/inpptree.c +++ b/src/spicelib/parser/inpptree.c @@ -1112,6 +1112,11 @@ INPparseNode *PT_mkfnode(const char *fname, INPparseNode * arg) return mkfirst(NULL, arg); } + if (!arg) { + fprintf(stderr, "Error: bad function arguments \n"); + return mkfirst(NULL, arg); + } + /* Make sure the case is ok. */ (void)strncpy(buf, fname, 127); buf[127] = 0;