forked from wolfSSL/wolfssl
fix for sanity check of null input
This commit is contained in:
@@ -3451,7 +3451,16 @@ int wc_PKCS7_SetCustomSKID(PKCS7* pkcs7, byte* in, word16 inSz)
|
|||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkcs7->customSKID = (byte*)XMALLOC(inSz, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
|
if (in == NULL) {
|
||||||
|
if (pkcs7->customSKID != NULL) {
|
||||||
|
XFREE(pkcs7->customSKID, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
|
||||||
|
}
|
||||||
|
pkcs7->customSKIDSz = 0;
|
||||||
|
pkcs7->customSKID = NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pkcs7->customSKID = (byte*)XMALLOC(inSz, pkcs7->heap,
|
||||||
|
DYNAMIC_TYPE_PKCS7);
|
||||||
if (pkcs7->customSKID == NULL) {
|
if (pkcs7->customSKID == NULL) {
|
||||||
ret = MEMORY_E;
|
ret = MEMORY_E;
|
||||||
}
|
}
|
||||||
@@ -3459,6 +3468,8 @@ int wc_PKCS7_SetCustomSKID(PKCS7* pkcs7, byte* in, word16 inSz)
|
|||||||
XMEMCPY(pkcs7->customSKID, in, inSz);
|
XMEMCPY(pkcs7->customSKID, in, inSz);
|
||||||
pkcs7->customSKIDSz = inSz;
|
pkcs7->customSKIDSz = inSz;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user