Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+5 -4
+5 -4
crypto/shash.c
··· 257 257 if (crypto_shash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) 258 258 return -ENOKEY; 259 259 260 - plen = crypto_shash_blocksize(tfm) + 1; 261 - descsize = crypto_shash_descsize(tfm); 262 260 ss = crypto_shash_statesize(tfm); 263 - buf[descsize - 1] = 0; 264 - if (crypto_shash_block_only(tfm)) 261 + if (crypto_shash_block_only(tfm)) { 262 + plen = crypto_shash_blocksize(tfm) + 1; 265 263 ss -= plen; 264 + descsize = crypto_shash_descsize(tfm); 265 + buf[descsize - 1] = 0; 266 + } 266 267 if (!import) { 267 268 memcpy(buf, in, ss); 268 269 return 0;