From 4c503c1e475224c5d412ca9caeb0c9abe2785f96 Mon Sep 17 00:00:00 2001 From: Fabio Rossi Date: Wed, 18 Oct 2017 19:50:46 +0200 Subject: [PATCH] src/tclspice.c, bug fix, broken trimming of the "spice::" namespace Due to a missing break in the for(;;) loop, causing the loop to walk beyond end of string argv[0], causing random behaviour. --- src/tclspice.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/tclspice.c b/src/tclspice.c index eea9c3d62..f29cea727 100644 --- a/src/tclspice.c +++ b/src/tclspice.c @@ -828,10 +828,9 @@ _tcl_dispatch TCL_CMDPROCARGS(clientData, interp, argc, argv) int i; NG_IGNORE(clientData); save_interp(); - /* Looks backwards through the first command and strips the :: part */ - for (i = strlen(argv[0])-1; i > 0; i--) - if (argv[0][i] == *":") - argv[0] += i + 1; + char *prefix = strstr(argv[0], "spice::"); + if (prefix) + argv[0] = prefix + 7; return _run(argc, (char **)argv); }