Merge pull request #558 from aidangarske/coverity-cid911493-fwtpm-pcr-props

Guard tainted PCR select copy in fwTPM properties Coverity test
pull/562/head
David Garske 2026-07-22 14:16:39 -07:00 committed by GitHub
commit 5a0350ff52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -8712,6 +8712,7 @@ static void test_fwtpm_pcr_properties_capability(void)
tag = GetU32BE(gRsp + p); p += 4;
wireSz = gRsp[p]; p += 1;
selSz = (wireSz > 8) ? 8 : wireSz;
AssertTrue(selSz > 0); /* select bytes present; keeps p inside gRsp */
AssertTrue(p + selSz <= rspSize);
if (tag == TPM_PT_PCR_RESET_L0) {
memcpy(resetL0, gRsp + p, selSz); gotResetL0 = 1;
@ -8725,6 +8726,7 @@ static void test_fwtpm_pcr_properties_capability(void)
else if (tag == TPM_PT_PCR_DRTM_RESET) {
memcpy(drtm, gRsp + p, selSz); gotDrtm = 1;
}
AssertTrue(p + wireSz <= rspSize); /* full record present on the wire */
p += wireSz; /* advance past the select bytes */
}