asn1: Do not crash on invalid arguments
This commit is contained in:
parent
a020b85d94
commit
cb8c7647ca
|
@ -1991,6 +1991,10 @@ static int asn1_encode(sc_context_t *ctx, const struct sc_asn1_entry *asn1,
|
|||
u8 *obj = NULL, *buf = NULL, *tmp;
|
||||
size_t total = 0, objsize;
|
||||
|
||||
if (asn1 == NULL) {
|
||||
return SC_ERROR_INVALID_ARGUMENTS;
|
||||
}
|
||||
|
||||
for (idx = 0; asn1[idx].name != NULL; idx++) {
|
||||
r = asn1_encode_entry(ctx, &asn1[idx], &obj, &objsize, depth);
|
||||
if (r) {
|
||||
|
|
Loading…
Reference in New Issue