diff options
-rw-r--r-- | lib/minitasn1/coding.c | 2 | ||||
-rw-r--r-- | lib/minitasn1/decoding.c | 13 | ||||
-rw-r--r-- | lib/minitasn1/element.c | 3 |
3 files changed, 12 insertions, 6 deletions
diff --git a/lib/minitasn1/coding.c b/lib/minitasn1/coding.c index 0c0f69c5ce..7821d85b7a 100644 --- a/lib/minitasn1/coding.c +++ b/lib/minitasn1/coding.c @@ -757,7 +757,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, asn1_node node) if (err != ASN1_SUCCESS) goto error; - t = class << 24; + t = ((unsigned int)class) << 24; p_vet->value = t | tag; counter += len2; diff --git a/lib/minitasn1/decoding.c b/lib/minitasn1/decoding.c index e5513a38b0..cfe2322910 100644 --- a/lib/minitasn1/decoding.c +++ b/lib/minitasn1/decoding.c @@ -1361,7 +1361,15 @@ asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len, { /* indefinite length method */ p->tmp_ival = -1; } + p2 = p->down; + if (p2 == NULL) + { + result = ASN1_DER_ERROR; + warn(); + goto cleanup; + } + while ((type_field (p2->type) == ASN1_ETYPE_TAG) || (type_field (p2->type) == ASN1_ETYPE_SIZE)) p2 = p2->right; @@ -1532,11 +1540,6 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len, return asn1_der_decoding2 (element, ider, &ider_len, 0, errorDescription); } -#define FOUND 1 -#define SAME_BRANCH 2 -#define OTHER_BRANCH 3 -#define EXIT 4 - /** * asn1_der_decoding_element: * @structure: pointer to an ASN1 structure diff --git a/lib/minitasn1/element.c b/lib/minitasn1/element.c index dceb8ba83e..b7a0905efb 100644 --- a/lib/minitasn1/element.c +++ b/lib/minitasn1/element.c @@ -152,7 +152,10 @@ _asn1_append_sequence_set (asn1_node node, struct node_tail_cache_st *pcache) while ((type_field (p->type) == ASN1_ETYPE_TAG) || (type_field (p->type) == ASN1_ETYPE_SIZE)) p = p->right; + p2 = _asn1_copy_structure3 (p); + if (p2 == NULL) + return ASN1_GENERIC_ERROR; if (pcache == NULL || pcache->tail == NULL || pcache->head != node) { |