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:49:43 +0000 (14:49 +0100)
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5060)

(cherry picked from commit e44c7d02ddac975ec6abff7901e77a0c37f9949d)

crypto/mem_sec.c

index 341347b0eaa45ab7d8b29b663380c65691e0394e..b26ba20a6214a50a13900eaff030c697edfaef7a 100644 (file)
@@ -24,7 +24,9 @@
 
 #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>