diff options
author | markus <> | 2002-07-30 11:08:06 +0000 |
---|---|---|
committer | markus <> | 2002-07-30 11:08:06 +0000 |
commit | c54a116b266c232d9e0ffad482eb5f8b98130ac4 (patch) | |
tree | 829382cb1d2140dc2ace3ac2b408324cabadb2f9 /src/lib/libcrypto/asn1/asn1_lib.c | |
parent | cc19216028038523578d8437fd5fe68bada0def0 (diff) | |
download | openbsd-c54a116b266c232d9e0ffad482eb5f8b98130ac4.tar.gz openbsd-c54a116b266c232d9e0ffad482eb5f8b98130ac4.tar.bz2 openbsd-c54a116b266c232d9e0ffad482eb5f8b98130ac4.zip |
apply patches from OpenSSL Security Advisory [30 July 2002],
http://marc.theaimsgroup.com/?l=openssl-dev&m=102802395104110&w=2
Diffstat (limited to 'src/lib/libcrypto/asn1/asn1_lib.c')
-rw-r--r-- | src/lib/libcrypto/asn1/asn1_lib.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index 830ff2af3c..fd8e77044e 100644 --- a/src/lib/libcrypto/asn1/asn1_lib.c +++ b/src/lib/libcrypto/asn1/asn1_lib.c | |||
@@ -123,15 +123,13 @@ int ASN1_get_object(unsigned char **pp, long *plength, int *ptag, int *pclass, | |||
123 | (int)(omax+ *pp)); | 123 | (int)(omax+ *pp)); |
124 | 124 | ||
125 | #endif | 125 | #endif |
126 | #if 0 | 126 | if (*plength > (omax - (*pp - p))) |
127 | if ((p+ *plength) > (omax+ *pp)) | ||
128 | { | 127 | { |
129 | ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_TOO_LONG); | 128 | ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_TOO_LONG); |
130 | /* Set this so that even if things are not long enough | 129 | /* Set this so that even if things are not long enough |
131 | * the values are set correctly */ | 130 | * the values are set correctly */ |
132 | ret|=0x80; | 131 | ret|=0x80; |
133 | } | 132 | } |
134 | #endif | ||
135 | *pp=p; | 133 | *pp=p; |
136 | return(ret|inf); | 134 | return(ret|inf); |
137 | err: | 135 | err: |
@@ -158,6 +156,8 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max) | |||
158 | i= *p&0x7f; | 156 | i= *p&0x7f; |
159 | if (*(p++) & 0x80) | 157 | if (*(p++) & 0x80) |
160 | { | 158 | { |
159 | if (i > sizeof(long)) | ||
160 | return 0; | ||
161 | if (max-- == 0) return(0); | 161 | if (max-- == 0) return(0); |
162 | while (i-- > 0) | 162 | while (i-- > 0) |
163 | { | 163 | { |
@@ -169,6 +169,8 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max) | |||
169 | else | 169 | else |
170 | ret=i; | 170 | ret=i; |
171 | } | 171 | } |
172 | if (ret < 0) | ||
173 | return 0; | ||
172 | *pp=p; | 174 | *pp=p; |
173 | *rl=ret; | 175 | *rl=ret; |
174 | return(1); | 176 | return(1); |
@@ -406,7 +408,7 @@ int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b) | |||
406 | 408 | ||
407 | void asn1_add_error(unsigned char *address, int offset) | 409 | void asn1_add_error(unsigned char *address, int offset) |
408 | { | 410 | { |
409 | char buf1[16],buf2[16]; | 411 | char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1]; |
410 | 412 | ||
411 | sprintf(buf1,"%lu",(unsigned long)address); | 413 | sprintf(buf1,"%lu",(unsigned long)address); |
412 | sprintf(buf2,"%d",offset); | 414 | sprintf(buf2,"%d",offset); |