diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2015-01-08 22:50:44 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2015-01-08 22:50:44 +0000 |
commit | 1b54c06563a2a52b2b26a116ab243c40bf4d0c9f (patch) | |
tree | e1295f92dee4cb6b09a209711754a49e3c0b90b1 /crypto/asn1/a_bitstr.c | |
parent | f62b4332f57a140c7a64082fb139c06b1a71584c (diff) |
Notes
Diffstat (limited to 'crypto/asn1/a_bitstr.c')
-rw-r--r-- | crypto/asn1/a_bitstr.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/asn1/a_bitstr.c b/crypto/asn1/a_bitstr.c index 0fb9ce0c2aea1..665fc09a1dc56 100644 --- a/crypto/asn1/a_bitstr.c +++ b/crypto/asn1/a_bitstr.c @@ -136,11 +136,16 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, p= *pp; i= *(p++); + if (i > 7) + { + i=ASN1_R_INVALID_BIT_STRING_BITS_LEFT; + goto err; + } /* We do this to preserve the settings. If we modify * the settings, via the _set_bit function, we will recalculate * on output */ ret->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear */ - ret->flags|=(ASN1_STRING_FLAG_BITS_LEFT|(i&0x07)); /* set */ + ret->flags|=(ASN1_STRING_FLAG_BITS_LEFT|i); /* set */ if (len-- > 1) /* using one because of the bits left byte */ { |