Quellcode durchsuchen

save the plain constructed-, sequence- or set-data details

Steffen Jaeckel vor 10 Jahren
Ursprung
Commit
7ddce245b8

+ 9 - 0
src/pk/asn1/der/sequence/der_decode_sequence_flexi.c

@@ -348,6 +348,15 @@ int der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc
                 l->type = LTC_ASN1_SET;
              }
 
+             if ((l->data = XMALLOC(len)) == NULL) {
+                err = CRYPT_MEM;
+                goto error;
+             }
+
+             XMEMCPY(l->data, in, len);
+             l->size = len;
+
+
              /* jump to the start of the data */
              in     += data_offset;
              *inlen -= data_offset;

+ 1 - 3
src/pk/asn1/der/sequence/der_sequence_free.c

@@ -46,9 +46,7 @@ void der_sequence_free(ltc_asn1_list *in)
       }
 
       switch (in->type) {
-         case LTC_ASN1_SET:
-         case LTC_ASN1_SETOF:
-         case LTC_ASN1_SEQUENCE: break;
+         case LTC_ASN1_SETOF: break;
          case LTC_ASN1_INTEGER : if (in->data != NULL) { mp_clear(in->data); } break;
          default               : if (in->data != NULL) { XFREE(in->data);    }
       }