Only implement secure malloc if _POSIX_VERSION allows
authorRichard Levitte <levitte@openssl.org>
Thu, 18 Jan 2018 13:05:33 +0000 (14:05 +0100)
committerRichard Levitte <levitte@openssl.org>
Thu, 18 Jan 2018 13:05:33 +0000 (14:05 +0100)
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5060)

crypto/mem_sec.c

index 0c24ed819bb86b0244fb98912b2f5eddaeadecf9..87c19a1395497283f07f27adc8cdd9e3fc0c391b 100644 (file)
@@ -20,7 +20,9 @@
 
 #include <string.h>
 
 
 #include <string.h>
 
-#if defined(OPENSSL_SYS_LINUX) || defined(OPENSSL_SYS_UNIX)
+/* e_os.h includes unistd.h, which defines _POSIX_VERSION */
+#if defined(OPENSSL_SYS_UNIX) \
+    && defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L
 # define IMPLEMENTED
 # include <stdlib.h>
 # include <assert.h>
 # define IMPLEMENTED
 # include <stdlib.h>
 # include <assert.h>