inpcom.c: remove bug in inp_add_series_resistor(),
prevent crash in inp_remove_ws() upon erroneous input
This commit is contained in:
parent
5c4f8946f6
commit
85244d0222
|
|
@ -2136,7 +2136,7 @@ inp_remove_ws(char *s)
|
||||||
char *buffer, *curr;
|
char *buffer, *curr;
|
||||||
bool is_expression = FALSE;
|
bool is_expression = FALSE;
|
||||||
|
|
||||||
big_buff = TMALLOC(char, strlen(s) + 1);
|
big_buff = TMALLOC(char, strlen(s) + 2);
|
||||||
curr = s;
|
curr = s;
|
||||||
|
|
||||||
while (*curr != '\0') {
|
while (*curr != '\0') {
|
||||||
|
|
@ -5488,13 +5488,14 @@ inp_add_series_resistor(struct line *deck)
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
tmp_p = strstr(curr_line, "rseries");
|
tmp_p = strstr(curr_line, "rseries");
|
||||||
/* default to "1m" if no value given */
|
tmp_p += 7;
|
||||||
|
/* default to "1e-3" if no value given */
|
||||||
if (ciprefix("=", tmp_p)) {
|
if (ciprefix("=", tmp_p)) {
|
||||||
tmp_p = strchr(tmp_p, '=') + 1;
|
tmp_p = strchr(tmp_p, '=') + 1;
|
||||||
rval = gettok(&tmp_p);
|
rval = gettok(&tmp_p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rval = copy("1m");
|
rval = copy("1e-3");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_rseries || !rval)
|
if (!has_rseries || !rval)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue