summaryrefslogtreecommitdiff
path: root/lib/libssl
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-05-31 19:09:21 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-05-31 19:09:21 +0000
commitf0c9abe2cd4bef6932d57c26b19496a346b9ba1a (patch)
tree69762dcd814a7e8d155edf1ffccffbf739f57910 /lib/libssl
parent1c18e1270492d3d494757a0fe4424b9b37b25679 (diff)
BUF_MEM_grow_clean() takes a size_t as the size argument. Remove false comments
mentioning it's an int, bogus (int) casts and bounds checks against INT_MAX (BUF_MEM_grow_clean has its own integer bounds checks). ok deraadt@
Diffstat (limited to 'lib/libssl')
-rw-r--r--lib/libssl/d1_both.c2
-rw-r--r--lib/libssl/s3_both.c10
2 files changed, 3 insertions, 9 deletions
diff --git a/lib/libssl/d1_both.c b/lib/libssl/d1_both.c
index d62362e69a1..8e2843625b8 100644
--- a/lib/libssl/d1_both.c
+++ b/lib/libssl/d1_both.c
@@ -946,7 +946,7 @@ dtls1_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x)
unsigned char *p;
n = i2d_X509(x, NULL);
- if (!BUF_MEM_grow_clean(buf, (int)(n + (*l) + 3))) {
+ if (!BUF_MEM_grow_clean(buf, n + (*l) + 3)) {
SSLerr(SSL_F_DTLS1_ADD_CERT_TO_BUF, ERR_R_BUF_LIB);
return 0;
}
diff --git a/lib/libssl/s3_both.c b/lib/libssl/s3_both.c
index 2a96c199146..b6249e3e1da 100644
--- a/lib/libssl/s3_both.c
+++ b/lib/libssl/s3_both.c
@@ -315,7 +315,7 @@ ssl3_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x)
unsigned char *p;
n = i2d_X509(x, NULL);
- if (!BUF_MEM_grow_clean(buf,(int)(n + (*l) + 3))) {
+ if (!BUF_MEM_grow_clean(buf, n + (*l) + 3)) {
SSLerr(SSL_F_SSL3_ADD_CERT_TO_BUF, ERR_R_BUF_LIB);
return (-1);
}
@@ -479,13 +479,7 @@ ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
SSLerr(SSL_F_SSL3_GET_MESSAGE, SSL_R_EXCESSIVE_MESSAGE_SIZE);
goto f_err;
}
- if (l > (INT_MAX-4)) /* BUF_MEM_grow takes an 'int' parameter */
- {
- al = SSL_AD_ILLEGAL_PARAMETER;
- SSLerr(SSL_F_SSL3_GET_MESSAGE, SSL_R_EXCESSIVE_MESSAGE_SIZE);
- goto f_err;
- }
- if (l && !BUF_MEM_grow_clean(s->init_buf,(int)l + 4)) {
+ if (l && !BUF_MEM_grow_clean(s->init_buf, l + 4)) {
SSLerr(SSL_F_SSL3_GET_MESSAGE, ERR_R_BUF_LIB);
goto err;
}