From 37762160fe2c6580a24f52cd223e6d166e31f25e Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Thu, 5 Jun 2014 15:50:19 +0200 Subject: Document that ider and ider_len are optional in asn1_der_decoding_startEnd() --- lib/decoding.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/decoding.c b/lib/decoding.c index 5f5d55b..f3ac191 100644 --- a/lib/decoding.c +++ b/lib/decoding.c @@ -1538,6 +1538,9 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName, * One example is the sequence "tbsCertificate" inside an X509 * certificate. * + * Note that since libtasn1 3.7 the @ider and @ider_len parameters + * can be omitted, if the element is already decoded using asn1_der_decoding(). + * * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND * if ELEMENT is %asn1_node EMPTY or @name_element is not a valid * element, %ASN1_TAG_ERROR or %ASN1_DER_ERROR if the der encoding @@ -1565,6 +1568,9 @@ asn1_der_decoding_startEnd (asn1_node element, const void *ider, int ider_len, if (*start == 0 && *end == 0) { + if (ider == NULL || ider_len == 0) + return ASN1_GENERIC_ERROR; + /* it seems asn1_der_decoding() wasn't called before. Do it now */ result = asn1_der_decoding (&node, ider, ider_len, NULL); if (result != ASN1_SUCCESS) -- cgit v1.2.3