From 8f9bf94a38e7add3dad3a2484c428e3dc6e8c7c7 Mon Sep 17 00:00:00 2001 From: dwarning Date: Sun, 31 Oct 2021 15:05:29 +0100 Subject: [PATCH] Aware of sscanf return value --- src/spicelib/parser/inpfindv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/spicelib/parser/inpfindv.c b/src/spicelib/parser/inpfindv.c index 729c3e4c0..1b320a25d 100644 --- a/src/spicelib/parser/inpfindv.c +++ b/src/spicelib/parser/inpfindv.c @@ -26,8 +26,10 @@ char *INPfindVer(char *line, char *version) } /* now the magic string */ - sscanf(where, "%s", version); /* We get the version number */ - + if (sscanf(where, "%s", version) != 1) { /* We get the version number */ + sprintf( version, "default" ); + printf("Warning -- Version not specified correct on line \"%s\"\nSetting version to 'default'.\n", line); + } return (NULL); } else { /* no level on the line => default */