Re: [PATCH net-next] tipc: potential memory corruption in tipc_crypto_key_rcv()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date: Wed, 23 Sep 2020 11:30:17 +0300

> This code uses "skey->keylen" as an memcpy() size and then checks that
> it is valid on the next line.  The other problem is that the check has
> a potential integer overflow, it's better to use struct_size() for this.
> 
> Fixes: 23700da29b83 ("tipc: add automatic rekeying for encryption key")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
> Hey Kees and Julia,
> 
> It would be nice to change tipc_aead_key_size() but I'm not sure how the
> UAPI stuff works.  My first attempt at to change it to
> 
> 	return struct_size(key, key, key->keylen);
> 
> broke the build.  I think you guys used Coccinelle to automatically
> update these calculations.  Probably this wasn't updated because you
> didn't want to break the build either?

If it is subject to overflows, the tipc_aead_key_size() helper
shouldn't be used as-is by userspace either.

Right?

Please find a way to fix that inline function instead without breaking
UAPI, thank you.



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux