diff options
author | Andrea Claudi <aclaudi@redhat.com> | 2021-05-01 18:32:30 +0200 |
---|---|---|
committer | David Ahern <dsahern@kernel.org> | 2021-05-09 22:08:47 +0000 |
commit | 28ee49e5153b02698f100ad4e390fe700f7bcf32 (patch) | |
tree | 0af6e59c6c35cf3059485837c41e177f093e1658 /tipc | |
parent | 93c267bfb49267fd94f68c3d014fc5909645de06 (diff) | |
download | iproute2-28ee49e5153b02698f100ad4e390fe700f7bcf32.tar.gz |
tipc: bail out if key is abnormally long
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>
Diffstat (limited to 'tipc')
-rw-r--r-- | tipc/misc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tipc/misc.c b/tipc/misc.c index 1daf3072..909975d8 100644 --- a/tipc/misc.c +++ b/tipc/misc.c @@ -113,6 +113,9 @@ int str2key(char *str, struct tipc_aead_key *key) } } + if (len > TIPC_AEAD_KEYLEN_MAX) + return -1; + /* Obtain key: */ if (!ishex) { key->keylen = len; |