F-3918 - Use element-count form for pcrArray bounds check

pull/503/head
Aidan Garske 2026-05-11 20:57:55 -07:00
parent 5149b3f34f
commit 5f6988d794
2 changed files with 4 additions and 4 deletions

View File

@ -167,9 +167,9 @@ int TPM2_Boot_SecretUnseal_Example(void* userCtx, int argc, char *argv[])
usage();
return 0;
}
if (pcrArraySz >= sizeof(pcrArray)) {
if (pcrArraySz >= sizeof(pcrArray) / sizeof(pcrArray[0])) {
printf("Too many -pcr= arguments (max %zu)\n",
sizeof(pcrArray));
sizeof(pcrArray) / sizeof(pcrArray[0]));
usage();
return 0;
}

View File

@ -274,9 +274,9 @@ int TPM2_PCR_PolicySign_Example(void* userCtx, int argc, char *argv[])
usage();
return 0;
}
if (pcrArraySz >= sizeof(pcrArray)) {
if (pcrArraySz >= sizeof(pcrArray) / sizeof(pcrArray[0])) {
printf("Too many -pcr= arguments (max %zu)\n",
sizeof(pcrArray));
sizeof(pcrArray) / sizeof(pcrArray[0]));
usage();
return 0;
}