summaryrefslogtreecommitdiff
path: root/src/libcharon/encoding/payloads/cert_payload.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/encoding/payloads/cert_payload.c')
-rw-r--r--src/libcharon/encoding/payloads/cert_payload.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libcharon/encoding/payloads/cert_payload.c b/src/libcharon/encoding/payloads/cert_payload.c
index 6dd3141f0..80239f654 100644
--- a/src/libcharon/encoding/payloads/cert_payload.c
+++ b/src/libcharon/encoding/payloads/cert_payload.c
@@ -320,7 +320,12 @@ cert_payload_t *cert_payload_create_from_cert(certificate_t *cert)
free(this);
return NULL;
}
- this->data = cert->get_encoding(cert);
+ if (!cert->get_encoding(cert, CERT_ASN1_DER, &this->data))
+ {
+ DBG1(DBG_ENC, "encoding certificate for cert payload failed");
+ free(this);
+ return NULL;
+ }
this->payload_length = CERT_PAYLOAD_HEADER_LENGTH + this->data.len;
return &this->public;
}