diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/util/ieee_merge.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/util/ieee_merge.c b/src/util/ieee_merge.c index a83ed9b..69ae252 100644 --- a/src/util/ieee_merge.c +++ b/src/util/ieee_merge.c @@ -13,6 +13,8 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> + /* CCTK includes */ #include "cctk.h" @@ -175,7 +177,8 @@ int main (int argc, char **argv) #endif } - attrData = malloc (IOnBytes (attrType, 1, &attrLen)); + /* for string attributes: allocate one more bytes for trailing NUL */ + attrData = malloc (IOnBytes (attrType, 1, &attrLen) + 1); if (IOreadAttribute (infile, j, attrData) < 0) { printf ("Cannot read value of attribute %d, skipping ...\n", j); |