mirror of https://github.com/wolfSSL/wolfTPM.git
F-3926 - Clamp -ownerauth length in seal_nv example
parent
069dd33772
commit
4e16a160f4
|
|
@ -196,7 +196,14 @@ int TPM2_NVRAM_SealNV_Example(void* userCtx, int argc, char *argv[])
|
|||
/* Set owner auth */
|
||||
parent.hndl = TPM_RH_OWNER;
|
||||
if (XSTRLEN(ownerAuth) > 0) {
|
||||
parent.auth.size = (int)XSTRLEN(ownerAuth);
|
||||
size_t authLen = XSTRLEN(ownerAuth);
|
||||
if (authLen > sizeof(parent.auth.buffer)) {
|
||||
fprintf(stderr, "-ownerauth value too long (max %zu)\n",
|
||||
sizeof(parent.auth.buffer));
|
||||
rc = BUFFER_E;
|
||||
goto exit;
|
||||
}
|
||||
parent.auth.size = (UINT16)authLen;
|
||||
XMEMCPY(parent.auth.buffer, ownerAuth, parent.auth.size);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue