asn1: Avoid calling malloc with 0 argument
Caused problems reported by oss-fuzz https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18758
This commit is contained in:
parent
cd51430ba7
commit
cc917b541f
@ -1500,11 +1500,13 @@ static int asn1_decode_entry(sc_context_t *ctx,struct sc_asn1_entry *entry,
|
||||
/* Allocate buffer if needed */
|
||||
if (entry->flags & SC_ASN1_ALLOC) {
|
||||
u8 **buf = (u8 **) parm;
|
||||
if (objlen > 0) {
|
||||
*buf = malloc(objlen);
|
||||
if (*buf == NULL) {
|
||||
r = SC_ERROR_OUT_OF_MEMORY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
c = *len = objlen;
|
||||
parm = *buf;
|
||||
} else
|
||||
|
Loading…
Reference in New Issue
Block a user