diff options
author | 2025-05-28 14:43:00 -0700 | |
---|---|---|
committer | 2025-05-28 14:43:00 -0700 | |
commit | 408aa67404405c8519ddee70bc0e6c55daa7c959 (patch) | |
tree | 6cc9e266d711e7b913c1a1450381679ec1a79312 /crypto | |
parent | Merge tag 'jfs-6.16' of github.com:kleikamp/linux-shaggy (diff) | |
parent | crypto: shash - Fix buffer overrun in import function (diff) | |
download | wireguard-linux-408aa67404405c8519ddee70bc0e6c55daa7c959.tar.xz wireguard-linux-408aa67404405c8519ddee70bc0e6c55daa7c959.zip |
Merge tag 'v6.16-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fix from Herbert Xu:
"Fix a buffer overflow regression in shash"
* tag 'v6.16-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
crypto: shash - Fix buffer overrun in import function
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/shash.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/shash.c b/crypto/shash.c index 37537d7995c7..4721f5f134f4 100644 --- a/crypto/shash.c +++ b/crypto/shash.c @@ -257,12 +257,13 @@ static int __crypto_shash_import(struct shash_desc *desc, const void *in, if (crypto_shash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) return -ENOKEY; - plen = crypto_shash_blocksize(tfm) + 1; - descsize = crypto_shash_descsize(tfm); ss = crypto_shash_statesize(tfm); - buf[descsize - 1] = 0; - if (crypto_shash_block_only(tfm)) + if (crypto_shash_block_only(tfm)) { + plen = crypto_shash_blocksize(tfm) + 1; ss -= plen; + descsize = crypto_shash_descsize(tfm); + buf[descsize - 1] = 0; + } if (!import) { memcpy(buf, in, ss); return 0; |