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.

This commit is contained in:
sjborley 2005-05-24 03:03:00 +00:00
parent 7ef2b45828
commit ef3a924d53
1 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,7 @@
/**********
Copyright 1990 Regents of the University of California. All rights reserved.
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;
struct variable *vv;
double dd;
char *buf[BSIZE_SP];
char buf[BSIZE_SP];
if (!cp_getvar("nopadding", VT_BOOL, (char *) &raw_padding))
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);
if (numdims > 1) {
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)
@ -178,7 +179,7 @@ raw_write(char *name, struct plot *pl, bool app, bool binary)
}
if (writedims) {
dimstring(v->v_dims, v->v_numdims, buf);
fprintf(fp, " dims=%s",*buf);
fprintf(fp, " dims=%s",buf);
}
(void) putc('\n', fp);
}