aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssl/crypto/asn1/asn1_lib.c
diff options
context:
space:
mode:
authorJacques Vidrine <nectar@FreeBSD.org>2002-07-31 14:05:34 +0000
committerJacques Vidrine <nectar@FreeBSD.org>2002-07-31 14:05:34 +0000
commit4fe386b7feefe15cb4a8ab6f99551c119e397175 (patch)
treedd38cd8b153455bacc295a95bbcd6cbeae6627b8 /crypto/openssl/crypto/asn1/asn1_lib.c
parenta466eda8fa67fd5f8d5edf18a81453c76b854b78 (diff)
downloadsrc-4fe386b7feefe15cb4a8ab6f99551c119e397175.tar.gz
src-4fe386b7feefe15cb4a8ab6f99551c119e397175.zip
Notes
Diffstat (limited to 'crypto/openssl/crypto/asn1/asn1_lib.c')
-rw-r--r--crypto/openssl/crypto/asn1/asn1_lib.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/openssl/crypto/asn1/asn1_lib.c b/crypto/openssl/crypto/asn1/asn1_lib.c
index a8b651e54e7c..1fe3fbc1fa78 100644
--- a/crypto/openssl/crypto/asn1/asn1_lib.c
+++ b/crypto/openssl/crypto/asn1/asn1_lib.c
@@ -124,15 +124,13 @@ int ASN1_get_object(unsigned char **pp, long *plength, int *ptag, int *pclass,
(int)(omax+ *pp));
#endif
-#if 0
- if ((p+ *plength) > (omax+ *pp))
+ if (*plength > (omax - (*pp - p)))
{
ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_TOO_LONG);
/* Set this so that even if things are not long enough
* the values are set correctly */
ret|=0x80;
}
-#endif
*pp=p;
return(ret|inf);
err:
@@ -159,6 +157,8 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
i= *p&0x7f;
if (*(p++) & 0x80)
{
+ if (i > sizeof(long))
+ return 0;
if (max-- == 0) return(0);
while (i-- > 0)
{
@@ -170,6 +170,8 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
else
ret=i;
}
+ if (ret < 0)
+ return 0;
*pp=p;
*rl=ret;
return(1);
@@ -407,7 +409,7 @@ int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b)
void asn1_add_error(unsigned char *address, int offset)
{
- char buf1[16],buf2[16];
+ char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1];
sprintf(buf1,"%lu",(unsigned long)address);
sprintf(buf2,"%d",offset);