Browse Source

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' ?
rlar 14 years ago
parent
commit
0336e31c57
  1. 8
      src/frontend/vectors.c

8
src/frontend/vectors.c

@ -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 {

Loading…
Cancel
Save