util-decode-der: fix hang detected by AFL

Fix hang that occurs when child->length is zero, resulting in an
endless loop.
pull/1997/head
Mats Klepsland 10 years ago committed by Victor Julien
parent 18f88a6344
commit c2f0f82bb4

@ -270,6 +270,12 @@ static Asn1Generic * DecodeAsn1DerGeneric(const unsigned char *buffer,
if (child == NULL)
return NULL;
/* child length should never be zero */
if (child->length == 0) {
SCFree(child);
return NULL;
}
child->header = el;
return child;
}

Loading…
Cancel
Save