summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/asn1_lib.c
diff options
context:
space:
mode:
authormarkus <>2002-09-05 22:44:52 +0000
committermarkus <>2002-09-05 22:44:52 +0000
commit715a204e4615e4a70a466fcb383a9a57cad5e6b8 (patch)
tree2d2e93c4a34d1f7f04aba73706353332d7700641 /src/lib/libcrypto/asn1/asn1_lib.c
parent15b5d84f9da2ce4bfae8580e56e34a859f74ad71 (diff)
downloadopenbsd-715a204e4615e4a70a466fcb383a9a57cad5e6b8.tar.gz
openbsd-715a204e4615e4a70a466fcb383a9a57cad5e6b8.tar.bz2
openbsd-715a204e4615e4a70a466fcb383a9a57cad5e6b8.zip
import openssl-0.9.7-beta3
Diffstat (limited to 'src/lib/libcrypto/asn1/asn1_lib.c')
-rw-r--r--src/lib/libcrypto/asn1/asn1_lib.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c
index 830ff2af3c..422685a3b4 100644
--- a/src/lib/libcrypto/asn1/asn1_lib.c
+++ b/src/lib/libcrypto/asn1/asn1_lib.c
@@ -59,6 +59,7 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62#include <openssl/asn1_mac.h>
62 63
63static int asn1_get_length(unsigned char **pp,int *inf,long *rl,int max); 64static int asn1_get_length(unsigned char **pp,int *inf,long *rl,int max);
64static void asn1_put_length(unsigned char **pp, int length); 65static void asn1_put_length(unsigned char **pp, int length);
@@ -123,15 +124,13 @@ int ASN1_get_object(unsigned char **pp, long *plength, int *ptag, int *pclass,
123 (int)(omax+ *pp)); 124 (int)(omax+ *pp));
124 125
125#endif 126#endif
126#if 0 127 if (*plength > (omax - (*pp - p)))
127 if ((p+ *plength) > (omax+ *pp))
128 { 128 {
129 ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_TOO_LONG); 129 ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_TOO_LONG);
130 /* Set this so that even if things are not long enough 130 /* Set this so that even if things are not long enough
131 * the values are set correctly */ 131 * the values are set correctly */
132 ret|=0x80; 132 ret|=0x80;
133 } 133 }
134#endif
135 *pp=p; 134 *pp=p;
136 return(ret|inf); 135 return(ret|inf);
137err: 136err:
@@ -158,6 +157,8 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
158 i= *p&0x7f; 157 i= *p&0x7f;
159 if (*(p++) & 0x80) 158 if (*(p++) & 0x80)
160 { 159 {
160 if (i > sizeof(long))
161 return 0;
161 if (max-- == 0) return(0); 162 if (max-- == 0) return(0);
162 while (i-- > 0) 163 while (i-- > 0)
163 { 164 {
@@ -169,6 +170,8 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
169 else 170 else
170 ret=i; 171 ret=i;
171 } 172 }
173 if (ret < 0)
174 return 0;
172 *pp=p; 175 *pp=p;
173 *rl=ret; 176 *rl=ret;
174 return(1); 177 return(1);
@@ -406,7 +409,7 @@ int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b)
406 409
407void asn1_add_error(unsigned char *address, int offset) 410void asn1_add_error(unsigned char *address, int offset)
408 { 411 {
409 char buf1[16],buf2[16]; 412 char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1];
410 413
411 sprintf(buf1,"%lu",(unsigned long)address); 414 sprintf(buf1,"%lu",(unsigned long)address);
412 sprintf(buf2,"%d",offset); 415 sprintf(buf2,"%d",offset);