From 1c5457e1807e23e88886f4a5ec6fb45384881282 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 16 Jun 2021 15:20:39 -0400 Subject: [PATCH] Corrected a minor issue that cropped up today in which the search for file extensions is greedy and picks the first matching extension starting at the front of the string, such that, e.g., "file.ext.spice" is interpreted as a ".ext" file and not a ".spice" file. --- base/netfile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base/netfile.c b/base/netfile.c index e54c615..3ecbdb4 100644 --- a/base/netfile.c +++ b/base/netfile.c @@ -896,7 +896,9 @@ char *ReadNetlist(char *fname, int *fnum) /* make first pass looking for extension */ for (index = 0; formats[index].extension != NULL; index++) { - if (strstr(fname, formats[index].extension) != NULL) { + int extlen = strlen(formats[index].extension); + int flen = strlen(fname); + if (!strcmp(fname + flen - extlen, formats[index].extension)) { return (*(formats[index].proc))(fname, fnum); } }