From 5d97491df4170ec4ad9ea53a0d15f13e66efb712 Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Thu, 28 Apr 2011 15:37:38 -0500 Subject: [svn-r20670] Fixed file name handling with char pointer incorrectly causing crash. (Reviewed by ADB) --- perform/zip_perf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/perform/zip_perf.c b/perform/zip_perf.c index 5729baf..bf5f2e5 100644 --- a/perform/zip_perf.c +++ b/perform/zip_perf.c @@ -292,10 +292,11 @@ uncompress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source, * Programmer: Bill Wendling, 06. June 2002 * Modifications: */ +#define ZIP_PERF_FILE "zip_perf.data" static void get_unique_name(void) { - const char *prefix = NULL, *tmpl = "zip_perf.data"; + const char *prefix = NULL; const char *env = getenv("HDF5_PREFIX"); if (env) @@ -306,9 +307,9 @@ get_unique_name(void) if (prefix) /* 2 = 1 for '/' + 1 for null terminator */ - filename = (char *) HDmalloc(strlen(prefix) + strlen(tmpl) + 2); + filename = (char *) HDmalloc(strlen(prefix) + strlen(ZIP_PERF_FILE) + 2); else - filename = (char *) HDmalloc(strlen(tmpl) + 1); + filename = (char *) HDmalloc(strlen(ZIP_PERF_FILE) + 1); if (!filename) error("out of memory"); @@ -317,7 +318,7 @@ get_unique_name(void) strcpy(filename, prefix); strcat(filename, "/"); } - strcat(filename, tmpl); + strcat(filename, ZIP_PERF_FILE); } /* -- cgit v0.12