mirror of
https://github.com/stefanberger/swtpm.git
synced 2026-08-12 15:12:02 +00:00
swtpm: log error if broken header is detected
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
1ff4c6c54a
commit
8a1de2ce47
@ -772,11 +772,17 @@ SWTPM_NVRAM_CheckHeader(unsigned char *data, uint32_t length,
|
||||
{
|
||||
blobheader *bh = (blobheader *)data;
|
||||
|
||||
if (length < sizeof(bh))
|
||||
if (length < sizeof(bh)) {
|
||||
logprintf(STDERR_FILENO,
|
||||
"not enough bytes for header: %u\n", length);
|
||||
return TPM_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
if (ntohl(bh->totlen) != length)
|
||||
if (ntohl(bh->totlen) != length) {
|
||||
logprintf(STDERR_FILENO,
|
||||
"broken header: bh->totlen %u != %u\n", htonl(bh->totlen), length);
|
||||
return TPM_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
if (bh->min_version > BLOB_HEADER_VERSION) {
|
||||
logprintf(STDERR_FILENO,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user