mirror of
https://git.code.sf.net/p/ngspice/ngspice
synced 2026-08-22 13:57:32 +02:00
vector.c, rewrite vec_basename(), FIXME !
This rewritten code is functionally equivalent to the previous code, yet the result is queer, because the char *v_name slot of struct dvec is read beyond its terminating '\0' Is there indeed some code in ngspice which creates v_name strings with an embedded '\0' ?
This commit is contained in:
@@ -860,14 +860,10 @@ char *
|
||||
vec_basename(struct dvec *v)
|
||||
{
|
||||
char buf[BSIZE_SP], *t, *s;
|
||||
int i;
|
||||
|
||||
if (strchr(v->v_name, '.')) {
|
||||
for (t = v->v_name, i = 0; *t; t++)
|
||||
buf[i++] = *t;
|
||||
buf[i] = '\0';
|
||||
if (cieq(v->v_plot->pl_typename, buf))
|
||||
(void) strcpy(buf, t + 1);
|
||||
if (cieq(v->v_plot->pl_typename, v->v_name))
|
||||
(void) strcpy(buf, v->v_name + strlen(v->v_name) + 1);
|
||||
else
|
||||
(void) strcpy(buf, v->v_name);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user