lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 30 Dec 2019 10:03:33 +0700
From:   Tuong Lien <tuong.t.lien@...tech.com.au>
To:     dsahern@...il.com, jmaloy@...hat.com, maloy@...jonn.com,
        ying.xue@...driver.com, netdev@...r.kernel.org,
        tipc-discussion@...ts.sourceforge.net
Subject: [iproute2] tipc: fix clang warning in tipc/node.c

When building tipc with clang, the following warning is found:

tipc
    CC       bearer.o
    CC       cmdl.o
    CC       link.o
    CC       media.o
    CC       misc.o
    CC       msg.o
    CC       nametable.o
    CC       node.o
node.c:182:24: warning: field 'key' with variable sized type 'struct tipc_aead_key' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
                struct tipc_aead_key key;

This commit fixes it by putting the memory area allocated for the user
input key along with the variable-sized 'key' structure in the 'union'
form instead.

Fixes: 24bee3bf9752 ("tipc: add new commands to set TIPC AEAD key")
Reported-by: Stephen Hemminger <stephen@...workplumber.org>
Signed-off-by: Tuong Lien <tuong.t.lien@...tech.com.au>
---
 tipc/node.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tipc/node.c b/tipc/node.c
index 6c796bfb..ffdaeaea 100644
--- a/tipc/node.c
+++ b/tipc/node.c
@@ -179,8 +179,10 @@ static int cmd_node_set_key(struct nlmsghdr *nlh, const struct cmd *cmd,
 			    struct cmdl *cmdl, void *data)
 {
 	struct {
-		struct tipc_aead_key key;
-		char mem[TIPC_AEAD_KEYLEN_MAX + 1];
+		union {
+			struct tipc_aead_key key;
+			char mem[TIPC_AEAD_KEY_SIZE_MAX];
+		};
 	} input = {};
 	struct opt opts[] = {
 		{ "algname",	OPT_KEYVAL,	NULL },
-- 
2.13.7

Powered by blists - more mailing lists