scan-build warnings / fixes

This commit is contained in:
Jacob Barthelmeh
2019-05-29 20:32:20 +07:00
parent ab0029f9ac
commit a7a51d8f33
2 changed files with 8 additions and 2 deletions

View File

@@ -3668,7 +3668,7 @@ static int PKCS7_VerifySignedData(PKCS7* pkcs7, const byte* hashBuf,
byte* in2, word32 in2Sz) byte* in2, word32 in2Sz)
{ {
word32 idx, outerContentType, contentTypeSz = 0, totalSz = 0; word32 idx, outerContentType, contentTypeSz = 0, totalSz = 0;
int length = 0, version, ret = 0; int length = 0, version = 0, ret = 0;
byte* content = NULL; byte* content = NULL;
byte* contentDynamic = NULL; byte* contentDynamic = NULL;
byte* sig = NULL; byte* sig = NULL;
@@ -11326,8 +11326,10 @@ int wc_PKCS7_DecodeEncryptedData(PKCS7* pkcs7, byte* in, word32 inSz,
encOID = 0; encOID = 0;
#endif #endif
if (ret == 0 && (encryptedContent = (byte*)XMALLOC( if (ret == 0 && (encryptedContent = (byte*)XMALLOC(
encryptedContentSz, pkcs7->heap, DYNAMIC_TYPE_PKCS7)) == NULL) encryptedContentSz, pkcs7->heap, DYNAMIC_TYPE_PKCS7)) == NULL) {
ret = MEMORY_E; ret = MEMORY_E;
break;
}
if (ret == 0) { if (ret == 0) {
XMEMCPY(encryptedContent, &pkiMsg[idx], encryptedContentSz); XMEMCPY(encryptedContent, &pkiMsg[idx], encryptedContentSz);

View File

@@ -20829,6 +20829,10 @@ static int myDecryptionFunc(PKCS7* pkcs7, int encryptOID, byte* iv, int ivSz,
memset(keyIdRaw, 0, sizeof(keyIdRaw)); memset(keyIdRaw, 0, sizeof(keyIdRaw));
ret = wc_PKCS7_GetAttributeValue(pkcs7, OID, sizeof(OID), keyIdRaw, ret = wc_PKCS7_GetAttributeValue(pkcs7, OID, sizeof(OID), keyIdRaw,
&keyIdSz); &keyIdSz);
if (ret < 0) {
return ret;
}
if (keyIdSz < 3) { if (keyIdSz < 3) {
printf("keyIdSz is smaller than expected\n"); printf("keyIdSz is smaller than expected\n");
return -1; return -1;