summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2018-03-30 18:23:07 +1100
committerDarren Tucker <dtucker@dtucker.net>2018-03-30 18:23:07 +1100
commit2c71ca1dd1efe458cb7dee3f8a1a566f913182c2 (patch)
tree4906d911bcd351c9113675939ab9bd89b30753ae
parent6b5a17bc14e896e3904dc58d889b58934cfacd24 (diff)
Disable native strndup and strnlen on AIX.
On at least some revisions of AIX, strndup returns unterminated strings under some conditions, apparently because strnlen returns incorrect values in those cases. Disable both on AIX and use the replacements from openbsd-compat. Fixes problem with ECDSA keys there, ok djm.
-rw-r--r--configure.ac2
-rw-r--r--openbsd-compat/strndup.c2
-rw-r--r--openbsd-compat/strnlen.c2
3 files changed, 4 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index bedacc2db..663062bef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -603,6 +603,8 @@ case "$host" in
603 [AIX 5.2 and 5.3 (and presumably newer) require this]) 603 [AIX 5.2 and 5.3 (and presumably newer) require this])
604 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd]) 604 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
605 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)]) 605 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
606 AC_DEFINE([BROKEN_STRNDUP], 1, [strndup broken, see APAR IY61211])
607 AC_DEFINE([BROKEN_STRNLEN], 1, [strnlen broken, see APAR IY62551])
606 ;; 608 ;;
607*-*-android*) 609*-*-android*)
608 AC_DEFINE([DISABLE_UTMP], [1], [Define if you don't want to use utmp]) 610 AC_DEFINE([DISABLE_UTMP], [1], [Define if you don't want to use utmp])
diff --git a/openbsd-compat/strndup.c b/openbsd-compat/strndup.c
index 0fcb96f6b..ebb4eccfb 100644
--- a/openbsd-compat/strndup.c
+++ b/openbsd-compat/strndup.c
@@ -17,7 +17,7 @@
17 */ 17 */
18 18
19#include "config.h" 19#include "config.h"
20#ifndef HAVE_STRNDUP 20#if !defined(HAVE_STRNDUP) || defined(BROKEN_STRNDUP)
21#include <sys/types.h> 21#include <sys/types.h>
22 22
23#include <stddef.h> 23#include <stddef.h>
diff --git a/openbsd-compat/strnlen.c b/openbsd-compat/strnlen.c
index 93d515595..8cc6b96b5 100644
--- a/openbsd-compat/strnlen.c
+++ b/openbsd-compat/strnlen.c
@@ -19,7 +19,7 @@
19/* OPENBSD ORIGINAL: lib/libc/string/strnlen.c */ 19/* OPENBSD ORIGINAL: lib/libc/string/strnlen.c */
20 20
21#include "config.h" 21#include "config.h"
22#ifndef HAVE_STRNLEN 22#if !defined(HAVE_STRNLEN) || defined(BROKEN_STRNLEN)
23#include <sys/types.h> 23#include <sys/types.h>
24 24
25#include <string.h> 25#include <string.h>