aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/openssl/crypto/asn1/asn1_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssl/crypto/asn1/asn1_lib.c')
-rw-r--r--crypto/openssl/crypto/asn1/asn1_lib.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/openssl/crypto/asn1/asn1_lib.c b/crypto/openssl/crypto/asn1/asn1_lib.c
index a3681c0e23c7..e4a56a926af7 100644
--- a/crypto/openssl/crypto/asn1/asn1_lib.c
+++ b/crypto/openssl/crypto/asn1/asn1_lib.c
@@ -57,6 +57,7 @@
*/
#include <stdio.h>
+#include <limits.h>
#include "cryptlib.h"
#include <openssl/asn1.h>
#include <openssl/asn1_mac.h>
@@ -141,7 +142,7 @@ err:
static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
{
unsigned char *p= *pp;
- long ret=0;
+ unsigned long ret=0;
int i;
if (max-- < 1) return(0);
@@ -170,10 +171,10 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
else
ret=i;
}
- if (ret < 0)
+ if (ret > LONG_MAX)
return 0;
*pp=p;
- *rl=ret;
+ *rl=(long)ret;
return(1);
}