summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2014-05-17 00:06:01 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2014-05-17 00:06:01 +0200
commit51612fca32dda445056ca9a7533bae258acd3ecb (patch)
tree1fc761b4b247f44f44cdbc316e7d88419cb626d6
parentf245088c5bd6c7e9bea18e5601ee24d431531558 (diff)
downloadlibtasn1-51612fca32dda445056ca9a7533bae258acd3ecb.tar.gz
libtasn1-51612fca32dda445056ca9a7533bae258acd3ecb.tar.bz2
libtasn1-51612fca32dda445056ca9a7533bae258acd3ecb.zip
check for zero size in time and object ids.
-rw-r--r--lib/decoding.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/decoding.c b/lib/decoding.c
index 1151afe..7c6c9af 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -284,9 +284,11 @@ _asn1_get_time_der (const unsigned char *der, int der_len, int *ret_len,
if (der_len <= 0 || str == NULL)
return ASN1_DER_ERROR;
+
str_len = asn1_get_length_der (der, der_len, &len_len);
- if (str_len < 0 || str_size < str_len)
+ if (str_len <= 0 || str_size < str_len)
return ASN1_DER_ERROR;
+
memcpy (str, der + len_len, str_len);
str[str_len] = 0;
*ret_len = str_len + len_len;
@@ -312,7 +314,7 @@ _asn1_get_objectid_der (const unsigned char *der, int der_len, int *ret_len,
len = asn1_get_length_der (der, der_len, &len_len);
- if (len < 0 || len > der_len || len_len > der_len)
+ if (len <= 0 || len + len_len > der_len)
return ASN1_DER_ERROR;
val1 = der[len_len] / 40;