summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>2017-02-12 16:50:18 -0500
committerPhil Pennock <pdp@exim.org>2017-02-12 16:50:18 -0500
commitbb33d92ccb5a2aed3219a99e2fd3f3df48fb00de (patch)
treefb57cf96173c378cbf96d58b0bbd1a1e59ba6878
parentd195b66d38fd2ef7407705eba04bb8b6953cd41d (diff)
downloadexim4-bb33d92ccb5a2aed3219a99e2fd3f3df48fb00de.tar.gz
os_getcwd(): do not realloc if there was no malloc().exim-4_89_RC5
(cherry picked from commit 4a5ee04fd186cb7d86a4f70821dacc55f8cce98d) (changelog added) Signed-off-by: Phil Pennock <pdp@exim.org>
-rw-r--r--doc/doc-txt/ChangeLog5
-rw-r--r--src/src/os.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 0af5504e3..39e17b350 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -6,7 +6,7 @@ options, and new features, see the NewStuff file next to this ChangeLog.
Exim version 4.89
--------------------
+-----------------
JH/01 Bug 1922: Support IDNA2008. This has slightly different conversion rules
than -2003 did; needs libidn2 in addition to libidn.
@@ -99,6 +99,9 @@ PP/08 Reduce a number of compilation warnings under clang; building with
JH/17 Fix inbound CHUNKING when DKIM disabled at runtime.
+HS/01 Fix portability problems introduced by PP/08 for platforms where
+ realloc(NULL) is not equivalent to malloc() [SunOS et al].
+
Exim version 4.88
-----------------
diff --git a/src/src/os.c b/src/src/os.c
index 47af038f7..ca24e8dd2 100644
--- a/src/src/os.c
+++ b/src/src/os.c
@@ -879,7 +879,7 @@ char * b = (char *)buffer;
if (!size) size = PATH_MAX;
if (!b && !(b = malloc(size))) return NULL;
if (!(b = getcwd(b, size))) return NULL;
-return realloc(b, strlen(b) + 1);
+return buffer ? buffer : realloc(b, strlen(b) + 1);
}
#endif