diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2009-08-06 16:22:57 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2009-08-06 16:22:57 +0000 |
commit | 059230b3203b842beba856b7998e71f70e7e454e (patch) | |
tree | dd3ed3446fc553b63aa7615ed6c198d3c491a6ee /crypto | |
parent | 19dac35e5fdadb3c966d7528cca7e0fee1d6a230 (diff) |
Reject leading 0x80 in OID subidentifiers.
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/asn1/a_object.c | 11 | ||||
-rw-r--r-- | crypto/asn1/asn1.h | 1 | ||||
-rw-r--r-- | crypto/asn1/asn1_err.c | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c index dc980421d0..d169f8c147 100644 --- a/crypto/asn1/a_object.c +++ b/crypto/asn1/a_object.c @@ -291,6 +291,17 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, ASN1_OBJECT *ret=NULL; const unsigned char *p; int i; + /* Sanity check OID encoding: can't have 0x80 in subidentifiers, see: + * X.690 8.19.2 + */ + for (i = 0, p = *pp + 1; i < len - 1; i++, p++) + { + if (*p == 0x80) + { + ASN1err(ASN1_F_C2I_ASN1_OBJECT,ASN1_R_INVALID_OBJECT_ENCODING); + return NULL; + } + } /* only the ASN1_OBJECTs from the 'table' will have values * for ->sn or ->ln */ diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h index e3385226d4..4e701633e0 100644 --- a/crypto/asn1/asn1.h +++ b/crypto/asn1/asn1.h @@ -1263,6 +1263,7 @@ void ERR_load_ASN1_strings(void); #define ASN1_R_INVALID_MIME_TYPE 200 #define ASN1_R_INVALID_MODIFIER 186 #define ASN1_R_INVALID_NUMBER 187 +#define ASN1_R_INVALID_OBJECT_ENCODING 212 #define ASN1_R_INVALID_SEPARATOR 131 #define ASN1_R_INVALID_TIME_FORMAT 132 #define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 diff --git a/crypto/asn1/asn1_err.c b/crypto/asn1/asn1_err.c index 5f5de98eed..ba88eb318b 100644 --- a/crypto/asn1/asn1_err.c +++ b/crypto/asn1/asn1_err.c @@ -240,6 +240,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]= {ERR_REASON(ASN1_R_INVALID_MIME_TYPE) ,"invalid mime type"}, {ERR_REASON(ASN1_R_INVALID_MODIFIER) ,"invalid modifier"}, {ERR_REASON(ASN1_R_INVALID_NUMBER) ,"invalid number"}, +{ERR_REASON(ASN1_R_INVALID_OBJECT_ENCODING),"invalid object encoding"}, {ERR_REASON(ASN1_R_INVALID_SEPARATOR) ,"invalid separator"}, {ERR_REASON(ASN1_R_INVALID_TIME_FORMAT) ,"invalid time format"}, {ERR_REASON(ASN1_R_INVALID_UNIVERSALSTRING_LENGTH),"invalid universalstring length"}, |