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 0c24ed8..87c19a1 100644 (file)
@@ -20,7 +20,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>