if (data->size > data->allocated) {
TPMLIB_LogTPM2Error("bn_prime_t: Require size larger %zu than "
"allocated %zu\n",
- data->size, data->allocated);
+ (size_t)data->size, (size_t)data->allocated);
rc = TPM_RC_SIZE;
}
}
break;
}
/* write data size before array */
- datasize = nrh->size - sizeof(NV_RAM_HEADER);
- if ((int)datasize < 0) {
+ if (nrh->size < sizeof(NV_RAM_HEADER)) {
TPMLIB_LogTPM2Error("NV_ORDERLY_RAM: datasize corrupted: %d\n",
(int)datasize);
break;
}
+ datasize = nrh->size - sizeof(NV_RAM_HEADER);
written += UINT16_Marshal(&datasize, buffer, size);
if (datasize > 0) {
/* append the data */