diff options
author | Ben Laurie <ben@links.org> | 2014-07-05 14:59:33 +0100 |
---|---|---|
committer | Ben Laurie <ben@links.org> | 2014-07-05 15:00:53 +0100 |
commit | d2ab55eb5ba5ffcca96253224c20ee1269b39b72 (patch) | |
tree | 684a7c7c7799e5fa0e3c6da60fa7a7d26d69c8d9 /ssl/s3_pkt.c | |
parent | 6835f572a94f399db5cda484af3bbfe7c89de6b8 (diff) | |
download | openssl-d2ab55eb5ba5ffcca96253224c20ee1269b39b72.tar.gz |
Reduce casting nastiness.
Diffstat (limited to 'ssl/s3_pkt.c')
-rw-r--r-- | ssl/s3_pkt.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c index 243992542b..dab2bd766f 100644 --- a/ssl/s3_pkt.c +++ b/ssl/s3_pkt.c @@ -643,6 +643,13 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len) #endif SSL3_BUFFER *wb=&(s->s3->wbuf); int i; + unsigned int u_len = (unsigned int)len; + + if (len < 0) + { + SSLerr(SSL_F_SSL3_WRITE_BYTES,SSL_R_SSL_NEGATIVE_LENGTH); + return -1; + } s->rwstate=SSL_NOTHING; OPENSSL_assert(s->s3->wnum <= INT_MAX); @@ -697,7 +704,7 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len) * compromise is considered worthy. */ if (type==SSL3_RT_APPLICATION_DATA && - len >= 4*(int)(max_send_fragment=s->max_send_fragment) && + u_len >= 4*(max_send_fragment=s->max_send_fragment) && s->compress==NULL && s->msg_callback==NULL && !SSL_USE_ETM(s) && SSL_USE_EXPLICIT_IV(s) && EVP_CIPHER_flags(s->enc_write_ctx->cipher)&EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK) @@ -718,7 +725,7 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len) EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE, max_send_fragment,NULL); - if (len>=8*(int)max_send_fragment) packlen *= 8; + if (u_len >= 8*max_send_fragment) packlen *= 8; else packlen *= 4; wb->buf=OPENSSL_malloc(packlen); |