]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
crypto: testmgr - fix out of bound read in __test_aead()
authorJerome Marchand <jmarchan@redhat.com>
Wed, 3 Feb 2016 12:58:12 +0000 (13:58 +0100)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 5 May 2017 13:13:52 +0000 (10:13 -0300)
commit3c42908c6140ff8cc51a620f03e0cd94e6329dcd
treed75f135445666180295df9c20ae78610367a7efb
parenta4c58802b1f5cd50bca03b2d69b448d208edd931
crypto: testmgr - fix out of bound read in __test_aead()

BugLink: http://bugs.launchpad.net/bugs/1688505
commit abfa7f4357e3640fdee87dfc276fd0f379fb5ae6 upstream.

__test_aead() reads MAX_IVLEN bytes from template[i].iv, but the
actual length of the initialisation vector can be shorter.
The length of the IV is already calculated earlier in the
function. Let's just reuses that. Also the IV length is currently
calculated several time for no reason. Let's fix that too.
This fix an out-of-bound error detected by KASan.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
crypto/testmgr.c