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.
This commit is contained in:
Fabio Rossi 2017-10-18 19:50:46 +02:00 committed by rlar
parent 06f2ce9087
commit 4c503c1e47
1 changed files with 3 additions and 4 deletions

View File

@ -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);
}