summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormiod <>2002-08-05 10:42:30 +0000
committermiod <>2002-08-05 10:42:30 +0000
commit2ff0832caf8c93caa459f42f0a83142f381ae599 (patch)
treea5ec8d9f47835d7a646f3294dea62b04c10db3b6
parentf2b57ef6b13a5639a18c96ff92368c26081c05e9 (diff)
downloadopenbsd-2ff0832caf8c93caa459f42f0a83142f381ae599.tar.gz
openbsd-2ff0832caf8c93caa459f42f0a83142f381ae599.tar.bz2
openbsd-2ff0832caf8c93caa459f42f0a83142f381ae599.zip
Better fixes from openssl cvs; from markus@
-rw-r--r--src/lib/libcrypto/asn1/asn1_lib.c7
-rw-r--r--src/lib/libssl/src/crypto/asn1/asn1_lib.c7
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:
140static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max) 141static 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:
140static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max) 141static 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