From 4baafb06b93c50c836bc178b2bd99a7edaff9163 Mon Sep 17 00:00:00 2001 From: tradke Date: Thu, 6 May 2004 15:53:22 +0000 Subject: Fixed memory allocation bug when reading string attributes. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@319 ebee0441-1374-4afa-a3b5-247f3ba15b9a --- src/util/ieee_recombiner.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/ieee_recombiner.c b/src/util/ieee_recombiner.c index 4b44ba9..76b7823 100644 --- a/src/util/ieee_recombiner.c +++ b/src/util/ieee_recombiner.c @@ -718,7 +718,9 @@ void copyAttributes (IOFile infile, IOFile outfile, int nprocs, #endif /* copy from Long to int */ tmp_int = num_elems; - buffer = malloc (IOnBytes (datatype, 1, &tmp_int)); + + /* add one more byte for trailing '\0' characters in string attributes */ + buffer = malloc (1 + IOnBytes (datatype, 1, &tmp_int)); IOreadAttribute (infile, attr, buffer); /* reset 'GH$nprocs', 'GH$ioproc_every', and 'unchunked' attributes -- cgit v1.2.3