From ef3a924d5339fcb9f6dfde953d4ec820dcfc0b86 Mon Sep 17 00:00:00 2001 From: sjborley Date: Tue, 24 May 2005 03:03:00 +0000 Subject: [PATCH] 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. --- src/frontend/rawfile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/frontend/rawfile.c b/src/frontend/rawfile.c index 6eab343a6..786449cb7 100644 --- a/src/frontend/rawfile.c +++ b/src/frontend/rawfile.c @@ -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); }