]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Disable native strndup and strnlen on AIX.
authorDarren Tucker <dtucker@dtucker.net>
Fri, 30 Mar 2018 07:23:07 +0000 (18:23 +1100)
committerDarren Tucker <dtucker@dtucker.net>
Fri, 30 Mar 2018 07:23:07 +0000 (18:23 +1100)
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
openbsd-compat/strndup.c
openbsd-compat/strnlen.c

index bedacc2db4016bc93a7cfa3282265527886ddba9..663062bef142fba5bb572a2e1607b75e13c75e89 100644 (file)
@@ -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])
index 0fcb96f6b09097da23bcf60a53b1a818f3b859f5..ebb4eccfb819eb0d90e730562080b772fda7bbbd 100644 (file)
@@ -17,7 +17,7 @@
  */
 
 #include "config.h"
-#ifndef HAVE_STRNDUP
+#if !defined(HAVE_STRNDUP) || defined(BROKEN_STRNDUP)
 #include <sys/types.h>
 
 #include <stddef.h>
index 93d515595c97f9b1f93ad33cbbc023e508af6459..8cc6b96b59ce8842c43ad053aafb8da90dd7ff41 100644 (file)
@@ -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>