Browse Source

Fixed a 'core-dump' that could be caused by the interactive 'write' command when the plot contains more than one dimension. This was due to improper use of a buffer in raw_write(), as pointed out by Dietmar Warning.

pre-master-46
sjborley 21 years ago
parent
commit
ef3a924d53
  1. 7
      src/frontend/rawfile.c

7
src/frontend/rawfile.c

@ -1,6 +1,7 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1986 Wayne A. Christopher, U. C. Berkeley CAD Group Author: 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
$Id$
**********/ **********/
/* /*
@ -43,7 +44,7 @@ raw_write(char *name, struct plot *pl, bool app, bool binary)
wordlist *wl; wordlist *wl;
struct variable *vv; struct variable *vv;
double dd; double dd;
char *buf[BSIZE_SP];
char buf[BSIZE_SP];
if (!cp_getvar("nopadding", VT_BOOL, (char *) &raw_padding)) if (!cp_getvar("nopadding", VT_BOOL, (char *) &raw_padding))
raw_padding = FALSE; raw_padding = FALSE;
@ -121,7 +122,7 @@ raw_write(char *name, struct plot *pl, bool app, bool binary)
fprintf(fp, "No. Points: %d\n", length); fprintf(fp, "No. Points: %d\n", length);
if (numdims > 1) { if (numdims > 1) {
dimstring(dims, numdims, buf); dimstring(dims, numdims, buf);
fprintf(fp, "Dimensions: %s\n", *buf);
fprintf(fp, "Dimensions: %s\n", buf);
} }
for (wl = pl->pl_commands; wl; wl = wl->wl_next) for (wl = pl->pl_commands; wl; wl = wl->wl_next)
@ -178,7 +179,7 @@ raw_write(char *name, struct plot *pl, bool app, bool binary)
} }
if (writedims) { if (writedims) {
dimstring(v->v_dims, v->v_numdims, buf); dimstring(v->v_dims, v->v_numdims, buf);
fprintf(fp, " dims=%s",*buf);
fprintf(fp, " dims=%s",buf);
} }
(void) putc('\n', fp); (void) putc('\n', fp);
} }

Loading…
Cancel
Save