Changeset 90285 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Jul 22, 2021 11:59:15 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/efi/efisignaturedb.cpp
r90283 r90285 60 60 RTUUID UuidOwner; 61 61 /** Size of the signature data in bytes. */ 62 size_tcbSignature;62 uint32_t cbSignature; 63 63 /** The signature data (variable in size). */ 64 64 RT_FLEXIBLE_ARRAY_EXTENSION … … 91 91 EFI_GUID GuidSignatureType; 92 92 /** The additional signature header for this signature type. */ 93 size_tcbSigHdr;93 uint32_t cbSigHdr; 94 94 /** Size of the signature data (including EFI_SIGNATURE_DATA), 95 95 * can be 0 size varies with each signature (X.509 for example). */ 96 size_tcbSig;96 uint32_t cbSig; 97 97 /** The internal signature type enum. */ 98 98 RTEFISIGTYPE enmSigType; … … 378 378 * @param cbSig Size of the signature data in bytes. 379 379 */ 380 static PRTEFISIGNATURE rtEfiSigDbAllocSignature(PCRTUUID pUuidOwner, size_t cbSig)380 static PRTEFISIGNATURE rtEfiSigDbAllocSignature(PCRTUUID pUuidOwner, uint32_t cbSig) 381 381 { 382 382 PRTEFISIGNATURE pSig = (PRTEFISIGNATURE)RTMemAllocZ(RT_UOFFSETOF_DYN(RTEFISIGNATURE, abSignature[cbSig])); … … 463 463 if (RT_SUCCESS(rc)) 464 464 { 465 if ( !pDesc->cbSig 466 || pDesc->cbSig - sizeof(EFI_SIGNATURE_DATA) == cbSig) 467 { 468 PRTEFISIGNATURE pSig = rtEfiSigDbAllocSignature(pUuidOwner, cbSig); 465 if ( ( !pDesc->cbSig 466 || pDesc->cbSig - sizeof(EFI_SIGNATURE_DATA) == cbSig) 467 && cbSig < UINT32_MAX) 468 { 469 PRTEFISIGNATURE pSig = rtEfiSigDbAllocSignature(pUuidOwner, (uint32_t)cbSig); 469 470 if (pSig) 470 471 { 471 rc = RTVfsFileRead(hVfsFileIn, &pSig->abSignature[0], cbSig, NULL /*pcbRead*/);472 rc = RTVfsFileRead(hVfsFileIn, &pSig->abSignature[0], (size_t)cbSig, NULL /*pcbRead*/); 472 473 if (RT_SUCCESS(rc)) 473 474 RTListAppend(&pThis->aLstSigTypes[enmSigType], &pSig->NdLst); … … 494 495 AssertPtrReturn(pUuidOwner, VERR_INVALID_POINTER); 495 496 AssertPtrReturn(pvBuf, VERR_INVALID_POINTER); 496 AssertReturn(cbBuf , VERR_INVALID_PARAMETER);497 AssertReturn(cbBuf && cbBuf < UINT32_MAX, VERR_INVALID_PARAMETER); 497 498 498 499 int rc = VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.