mirror of
https://github.com/openssh/openssh-portable.git
synced 2026-11-06 05:16:43 +00:00
use nonnull attribute when available
Set this attribute on a few string to avoid compiler warnings from -Wunterminated-string-initialization warnings in recent gcc.
This commit is contained in:
4 files changed
+20
-3
No files matched your search
@@ -48,8 +48,8 @@ typedef struct chacha_ctx chacha_ctx;
|
||||
a = PLUS(a,b); d = ROTATE(XOR(d,a), 8); \
|
||||
c = PLUS(c,d); b = ROTATE(XOR(b,c), 7);
|
||||
|
||||
static const char sigma[16] = "expand 32-byte k";
|
||||
static const char tau[16] = "expand 16-byte k";
|
||||
static const char __attribute__ ((__nonstring__)) sigma[16] = "expand 32-byte k";
|
||||
static const char __attribute__ ((__nonstring__)) tau[16] = "expand 16-byte k";
|
||||
|
||||
void
|
||||
chacha_keysetup(chacha_ctx *x,const u8 *k,u32 kbits)
|
||||
|
||||
@@ -358,6 +358,19 @@ AC_COMPILE_IFELSE(
|
||||
[ AC_MSG_RESULT([no]) ]
|
||||
)
|
||||
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
AC_MSG_CHECKING([if compiler supports __nonstring__ attribute on char arrays])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <stdlib.h>]],
|
||||
[[ char __attribute__ ((__nonstring__)) h[5] = "hello"; return h[0]!='h'; ]])],
|
||||
[ AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_ATTRIBUTE__NONSTRING__, [1],
|
||||
[compiler supports nonstring attribute]) ],
|
||||
[ AC_MSG_RESULT([no]) ]
|
||||
)
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
|
||||
if test "x$no_attrib_nonnull" != "x1" ; then
|
||||
AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
|
||||
fi
|
||||
|
||||
@@ -604,6 +604,10 @@ struct winsize {
|
||||
# define __nonnull__(x)
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_ATTRIBUTE__NONSTRING__) && !defined(__nonstring__)
|
||||
# define __nonstring__
|
||||
#endif
|
||||
|
||||
#ifndef OSSH_ALIGNBYTES
|
||||
#define OSSH_ALIGNBYTES (sizeof(int) - 1)
|
||||
#endif
|
||||
|
||||
@@ -73,7 +73,7 @@ static void
|
||||
bcrypt_hash(uint8_t *sha2pass, uint8_t *sha2salt, uint8_t *out)
|
||||
{
|
||||
blf_ctx state;
|
||||
uint8_t ciphertext[BCRYPT_HASHSIZE] =
|
||||
uint8_t __attribute__ ((__nonstring__)) ciphertext[BCRYPT_HASHSIZE] =
|
||||
"OxychromaticBlowfishSwatDynamite";
|
||||
uint32_t cdata[BCRYPT_WORDS];
|
||||
int i;
|
||||
|
||||
Reference in new issue
Block a user