mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-05-04 22:44:13 +02:00
Updated per PR comments.
This commit is contained in:
+10
-8
@@ -1072,22 +1072,24 @@ WOLFSSL_OCSP_CERTID* wolfSSL_d2i_OCSP_CERTID(WOLFSSL_OCSP_CERTID** cidOut,
|
||||
const unsigned char** derIn,
|
||||
int length)
|
||||
{
|
||||
if ((derIn == NULL) || (length == 0))
|
||||
if ((cidOut == NULL) || (derIn == NULL) || (length == 0))
|
||||
return (NULL);
|
||||
|
||||
if (*cidOut != NULL) {
|
||||
XMEMCPY ((*cidOut)->rawCertId, *derIn, length);
|
||||
(*cidOut)->rawCertIdSize = length;
|
||||
}
|
||||
else {
|
||||
/* If a NULL is passed we allocate the memory for the caller. */
|
||||
if (*cidOut == NULL) {
|
||||
*cidOut = (WOLFSSL_OCSP_CERTID*)XMALLOC(length, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||
|
||||
if (*cidOut == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
XMEMCPY ((*cidOut)->rawCertId, *derIn, length);
|
||||
(*cidOut)->rawCertIdSize = length;
|
||||
}
|
||||
|
||||
XMEMCPY ((*cidOut)->rawCertId, *derIn, length);
|
||||
(*cidOut)->rawCertIdSize = length;
|
||||
|
||||
/* Per spec. advance past the data that is being returned to the caller. */
|
||||
*derIn = *derIn + length;
|
||||
|
||||
return (*cidOut);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user