diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1_lib.c | 7 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/asn1/asn1_lib.c | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index 46731b2438..f210be9559 100644 --- a/src/lib/libcrypto/asn1/asn1_lib.c +++ b/src/lib/libcrypto/asn1/asn1_lib.c | |||
| @@ -57,6 +57,7 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <limits.h> | ||
| 60 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 61 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 62 | 63 | ||
| @@ -140,7 +141,7 @@ err: | |||
| 140 | static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max) | 141 | static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max) |
| 141 | { | 142 | { |
| 142 | unsigned char *p= *pp; | 143 | unsigned char *p= *pp; |
| 143 | long ret=0; | 144 | unsigned long ret=0; |
| 144 | int i; | 145 | int i; |
| 145 | 146 | ||
| 146 | if (max-- < 1) return(0); | 147 | if (max-- < 1) return(0); |
| @@ -169,10 +170,10 @@ 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 | } |
| 172 | if (ret < 0) | 173 | if (ret > LONG_MAX) |
| 173 | return 0; | 174 | return 0; |
| 174 | *pp=p; | 175 | *pp=p; |
| 175 | *rl=ret; | 176 | *rl=(long)ret; |
| 176 | return(1); | 177 | return(1); |
| 177 | } | 178 | } |
| 178 | 179 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_lib.c b/src/lib/libssl/src/crypto/asn1/asn1_lib.c index 46731b2438..f210be9559 100644 --- a/src/lib/libssl/src/crypto/asn1/asn1_lib.c +++ b/src/lib/libssl/src/crypto/asn1/asn1_lib.c | |||
| @@ -57,6 +57,7 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <limits.h> | ||
| 60 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 61 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 62 | 63 | ||
| @@ -140,7 +141,7 @@ err: | |||
| 140 | static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max) | 141 | static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max) |
| 141 | { | 142 | { |
| 142 | unsigned char *p= *pp; | 143 | unsigned char *p= *pp; |
| 143 | long ret=0; | 144 | unsigned long ret=0; |
| 144 | int i; | 145 | int i; |
| 145 | 146 | ||
| 146 | if (max-- < 1) return(0); | 147 | if (max-- < 1) return(0); |
| @@ -169,10 +170,10 @@ 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 | } |
| 172 | if (ret < 0) | 173 | if (ret > LONG_MAX) |
| 173 | return 0; | 174 | return 0; |
| 174 | *pp=p; | 175 | *pp=p; |
| 175 | *rl=ret; | 176 | *rl=(long)ret; |
| 176 | return(1); | 177 | return(1); |
| 177 | } | 178 | } |
| 178 | 179 | ||
