[openssh-commits] [openssh] 01/01: Disable native strndup and strnlen on AIX.

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Mar 30 18:26:02 AEDT 2018


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 2c71ca1dd1efe458cb7dee3f8a1a566f913182c2
Author: Darren Tucker <dtucker at dtucker.net>
Date:   Fri Mar 30 18:23:07 2018 +1100

    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.
---
 configure.ac             | 2 ++
 openbsd-compat/strndup.c | 2 +-
 openbsd-compat/strnlen.c | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index bedacc2d..663062be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -603,6 +603,8 @@ case "$host" in
 	    [AIX 5.2 and 5.3 (and presumably newer) require this])
 	AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
 	AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
+	AC_DEFINE([BROKEN_STRNDUP], 1, [strndup broken, see APAR IY61211])
+	AC_DEFINE([BROKEN_STRNLEN], 1, [strnlen broken, see APAR IY62551])
 	;;
 *-*-android*)
 	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 0fcb96f6..ebb4eccf 100644
--- a/openbsd-compat/strndup.c
+++ b/openbsd-compat/strndup.c
@@ -17,7 +17,7 @@
  */
 
 #include "config.h"
-#ifndef HAVE_STRNDUP
+#if !defined(HAVE_STRNDUP) || defined(BROKEN_STRNDUP)
 #include <sys/types.h>
 
 #include <stddef.h>
diff --git a/openbsd-compat/strnlen.c b/openbsd-compat/strnlen.c
index 93d51559..8cc6b96b 100644
--- a/openbsd-compat/strnlen.c
+++ b/openbsd-compat/strnlen.c
@@ -19,7 +19,7 @@
 /* OPENBSD ORIGINAL: lib/libc/string/strnlen.c */
 
 #include "config.h"
-#ifndef HAVE_STRNLEN
+#if !defined(HAVE_STRNLEN) || defined(BROKEN_STRNLEN)
 #include <sys/types.h>
 
 #include <string.h>

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list