aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/asn1/der_decoder.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2006-04-04 12:45:29 +0000
committerMartin Willi <martin@strongswan.org>2006-04-04 12:45:29 +0000
commitf2ee13a7e844c5b107137ca21136684c610f2864 (patch)
treef90e948f8ad1f356c1d326ba8c302aace5cb6e98 /Source/charon/asn1/der_decoder.c
parentefadbf79e9c864578bfd1277d824e69b2989aac5 (diff)
downloadstrongswan-f2ee13a7e844c5b107137ca21136684c610f2864.tar.bz2
strongswan-f2ee13a7e844c5b107137ca21136684c610f2864.tar.xz
- improved strokeing
- down connection - status - some other tweaks
Diffstat (limited to 'Source/charon/asn1/der_decoder.c')
-rw-r--r--Source/charon/asn1/der_decoder.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/charon/asn1/der_decoder.c b/Source/charon/asn1/der_decoder.c
index 91521b96a..9ded40f59 100644
--- a/Source/charon/asn1/der_decoder.c
+++ b/Source/charon/asn1/der_decoder.c
@@ -48,7 +48,7 @@ struct private_der_decoder_t {
asn1_rule_t *rule;
/**
- * First rule of the hole ruleset
+ * First rule of the whole ruleset
*/
asn1_rule_t *first_rule;
@@ -273,6 +273,11 @@ status_t read_bitstring(private_der_decoder_t *this, chunk_t data)
data.ptr += 1;
data.len -= 1;
+ if (data.len < 1)
+ {
+ return FAILED;
+ }
+
chunk_t *chunk = (chunk_t*)((u_int8_t*)this->output + this->rule->data_offset);
*chunk = allocator_clone_chunk(data);
@@ -302,6 +307,11 @@ u_int32_t read_length(chunk_t *data)
u_int8_t n;
size_t len;
+ if (data->len < 1)
+ {
+ return -1;
+ }
+
/* read first octet of length field */
n = *data->ptr;
data->ptr++; data->len--;