From 3280e08b9baad039a929fcfb479aabc717bc2b70 Mon Sep 17 00:00:00 2001 From: Leon Arber Date: Wed, 7 Sep 2005 16:19:06 -0500 Subject: [svn-r11364] Purpose: Bug fix Description: Incorrectly terminated the received string in getenv_all Solution: Tasks would incorrectly terminat the environment string they received from the root task in getenv_all. They did the equivalent of: env[strlen(str) + 1] = '\0'. This resulted in a single "garbage" character inserted at the end of the string. This wasn't noticed until now because it seems that on most platforms this garbage character was a 0 anyway. This has been corrected to; env[strlen(str)] = '\0'. Platforms tested: Red Storm (where the bug was discovered) heping (pp) Misc. update: --- test/h5test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/h5test.c b/test/h5test.c index 027cb82..c9a788d 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -915,7 +915,7 @@ char* getenv_all(MPI_Comm comm, int root, const char* name) env = (char*) HDrealloc(env, len+1); MPI_Bcast(env, len, MPI_CHAR, root, comm); - env[len+1] = '\0'; + env[len] = '\0'; } else { -- cgit v0.12