tpm2: use ELEMENTSOF() instead of sizeof() for TPML_PCR_SELECTION pcrSelections field
authorDan Streetman <ddstreet@ieee.org>
Fri, 4 Aug 2023 20:12:05 +0000 (16:12 -0400)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 5 Aug 2023 04:31:59 +0000 (13:31 +0900)
commit9afd4dde22f852fa4643799b218bef268a76272c
tree6d188da4704b9be3ab091746999fcb02d0eef8ff
parent42f13f10d5ecf24c1849925ad9e8c53a08292ab3
tpm2: use ELEMENTSOF() instead of sizeof() for TPML_PCR_SELECTION pcrSelections field

The count field indicates the number of elements in the pcrSelections field,
and the size of each elements is greater than 1 byte, so using sizeof() is
incorrect when verifying the count field is valid; instead ELEMENTSOF() should
be used.

Caught by coverity check: https://github.com/systemd/systemd/pull/26331#pullrequestreview-1556629586
src/shared/tpm2-util.c