]> git.proxmox.com Git - swtpm.git/commit
swtpm: Check header size indicator against expected size (CID 375869)
authorStefan Berger <stefanb@linux.ibm.com>
Wed, 16 Feb 2022 16:17:47 +0000 (11:17 -0500)
committerStefan Berger <stefanb@us.ibm.com>
Thu, 17 Feb 2022 12:42:18 +0000 (07:42 -0500)
commitb36664bfb8a792a7dd6baa253c3adbcf10dc6995
tree92f1022a5a60a28caf299d41cbdc2b0623b421d5
parenta451415c6d6841bbcfdf43975848f1611c59eaa3
swtpm: Check header size indicator against expected size (CID 375869)

This fix addresses Coverity issue CID 375869.

Check the header size indicated in the header of the state against the
expected size and return an error code in case the header size indicator
is different. There was only one header size so far since blobheader was
introduced, so we don't need to deal with different sizes.

Without this fix a specially crafted header could cause out-of-bounds
accesses on the byte array containing the swtpm's state.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
src/swtpm/swtpm_nvstore.c