Commit 408aa674 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 1cbf99e4 0a84874c
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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;

	ss = crypto_shash_statesize(tfm);
	if (crypto_shash_block_only(tfm)) {
		plen = crypto_shash_blocksize(tfm) + 1;
		ss -= plen;
		descsize = crypto_shash_descsize(tfm);
	ss = crypto_shash_statesize(tfm);
		buf[descsize - 1] = 0;
	if (crypto_shash_block_only(tfm))
		ss -= plen;
	}
	if (!import) {
		memcpy(buf, in, ss);
		return 0;