summaryrefslogtreecommitdiff
path: root/lib/decoding.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2014-05-22 23:33:08 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2014-05-22 23:33:08 +0200
commit53958290ab731c8486531a3bdef54a933533579d (patch)
treead91281ee6f0ab20ef6ba7a93f1bf2838c79cc41 /lib/decoding.c
parent99af70b17ad87e910c528c9203f261bf4e513f54 (diff)
downloadlibtasn1-53958290ab731c8486531a3bdef54a933533579d.tar.gz
libtasn1-53958290ab731c8486531a3bdef54a933533579d.tar.bz2
libtasn1-53958290ab731c8486531a3bdef54a933533579d.zip
Allow a NULL value in asn1_read_value() for all types.
Diffstat (limited to 'lib/decoding.c')
-rw-r--r--lib/decoding.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/decoding.c b/lib/decoding.c
index 93bc962..90a37ff 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -254,7 +254,6 @@ asn1_get_octet_der (const unsigned char *der, int der_len,
if (der_len <= 0)
return ASN1_GENERIC_ERROR;
- /* if(str==NULL) return ASN1_SUCCESS; */
*str_len = asn1_get_length_der (der, der_len, &len_len);
if (*str_len < 0)
@@ -263,7 +262,7 @@ asn1_get_octet_der (const unsigned char *der, int der_len,
*ret_len = *str_len + len_len;
if (str_size >= *str_len)
{
- if (*str_len > 0)
+ if (*str_len > 0 && str != NULL)
memcpy (str, der + len_len, *str_len);
}
else
@@ -380,6 +379,7 @@ asn1_get_bit_der (const unsigned char *der, int der_len,
if (der_len <= 0)
return ASN1_GENERIC_ERROR;
+
len_byte = asn1_get_length_der (der, der_len, &len_len) - 1;
if (len_byte < 0)
return ASN1_DER_ERROR;
@@ -392,7 +392,7 @@ asn1_get_bit_der (const unsigned char *der, int der_len,
if (str_size >= len_byte)
{
- if (len_byte > 0)
+ if (len_byte > 0 && str)
memcpy (str, der + len_len + 1, len_byte);
}
else