fix unterminated result in subst_token()
This commit is contained in:
parent
8e4e23cf2d
commit
7cab8d9e73
|
|
@ -1149,7 +1149,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
{
|
||||
char *s=NULL;
|
||||
my_strdup(894, &s, subst_token(argv[2], argv[3], strcmp(argv[4], "NULL") ? argv[4] : NULL));
|
||||
Tcl_SetResult(interp, s, TCL_VOLATILE);
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_AppendResult(interp, s, NULL);
|
||||
my_free(1150, &s);
|
||||
}
|
||||
|
||||
|
|
@ -1157,14 +1158,16 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
{
|
||||
char s[30];
|
||||
my_snprintf(s, S(s), "%d", (int)get_tok_size);
|
||||
Tcl_SetResult(interp, s, TCL_VOLATILE);
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_AppendResult(interp, s, NULL);
|
||||
}
|
||||
|
||||
else if(!strcmp(argv[1],"get_tok") )
|
||||
{
|
||||
char *s=NULL;
|
||||
my_strdup(648, &s, get_tok_value(argv[2], argv[3], 0));
|
||||
Tcl_SetResult(interp, s, TCL_VOLATILE);
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_AppendResult(interp, s, NULL);
|
||||
my_free(649, &s);
|
||||
}
|
||||
else if(!strcmp(argv[1],"load_symbol") )
|
||||
|
|
|
|||
|
|
@ -859,7 +859,7 @@ char *subst_token(const char *s, const char *tok, const char *new_val)
|
|||
}
|
||||
else result[result_pos++]=c;
|
||||
} else if(state == XEND || state == XBEGIN) {
|
||||
if(cmptok || new_val) result[result_pos++] = c; /* if deleting a token skip also following spaces up to next token */
|
||||
if(c == '\0' || cmptok || new_val) result[result_pos++] = c; /* if deleting a token skip also following spaces up to next token */
|
||||
state = XBEGIN;
|
||||
}
|
||||
if(c == '\0') break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue