Fixed regressions #7066 and #7067 (#7074)

This commit is contained in:
Giovanni 2017-03-20 15:25:14 +01:00 committed by radare
parent ca0c4908dc
commit c25c6ae32a
2 changed files with 7 additions and 7 deletions

View File

@ -308,16 +308,16 @@ RPKCS7Attribute* r_pkcs7_parse_attribute (RASN1Object *object) {
if (!object || object->list.length < 1) {
return NULL;
}
attribute = (RPKCS7Attribute*) malloc (sizeof (RPKCS7Attribute));
attribute = R_NEW0 (RPKCS7Attribute);
if (!attribute) {
return NULL;
}
memset (attribute, 0, sizeof (RPKCS7Attribute));
attribute->oid = r_asn1_stringify_oid (object->list.objects[0]->sector, object->list.objects[0]->length);
if (object->list.objects[0]) {
attribute->oid = r_asn1_stringify_oid (object->list.objects[0]->sector, object->list.objects[0]->length);
}
if (object->list.length == 2) {
R_PTR_MOVE (attribute->data, object->list.objects[1]);
}
return attribute;
}
@ -337,7 +337,7 @@ bool r_pkcs7_parse_attributes (RPKCS7Attributes* attributes, RASN1Object *object
attributes->length = object->list.length;
if (attributes->length > 0) {
attributes->elements = R_NEWS0(RPKCS7Attribute*, attributes->length);
attributes->elements = R_NEWS0 (RPKCS7Attribute*, attributes->length);
if (!attributes->elements) {
attributes->length = 0;
return false;

View File

@ -36,10 +36,10 @@ bool r_x509_parse_validity (RX509Validity *validity, RASN1Object *object) {
}
bool r_x509_parse_algorithmidentifier (RX509AlgorithmIdentifier *ai, RASN1Object * object) {
if (!ai || !object || object->list.length < 1) {
if (!ai || !object || object->list.length < 1 || !object->list.objects) {
return false;
}
if (object->list.objects[0]->klass == CLASS_UNIVERSAL && object->list.objects[0]->tag == TAG_OID) {
if (object->list.objects[0] && object->list.objects[0]->klass == CLASS_UNIVERSAL && object->list.objects[0]->tag == TAG_OID) {
ai->algorithm = r_asn1_stringify_oid (object->list.objects[0]->sector, object->list.objects[0]->length);
}
ai->parameters = NULL; // TODO