tipc segfaults when called with an abnormally long key:
$ tipc node set key
0123456789abcdef0123456789abcdef0123456789abcdef
*** buffer overflow detected ***: terminated
Fix this returning an error if key length is longer than
TIPC_AEAD_KEYLEN_MAX.
Fixes: 24bee3bf9752 ("tipc: add new commands to set TIPC AEAD key")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
}
}
+ if (len > TIPC_AEAD_KEYLEN_MAX)
+ return -1;
+
/* Obtain key: */
if (!ishex) {
key->keylen = len;