diff options
author | Ben Laurie <ben@openssl.org> | 2008-12-29 16:11:58 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 2008-12-29 16:11:58 +0000 |
commit | 0eab41fb78cf4d7c76e563fd677ab6c32fc28bb0 (patch) | |
tree | da848c7424ced86fc60823f4948b0fc79e52a381 /ssl/d1_pkt.c | |
parent | 8aa02e97a782a4229936d5df6da42db3efe4acd1 (diff) |
If we're going to return errors (no matter how stupid), then we should
test for them!
Diffstat (limited to 'ssl/d1_pkt.c')
-rw-r--r-- | ssl/d1_pkt.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c index daf1fee881..dea63d694a 100644 --- a/ssl/d1_pkt.c +++ b/ssl/d1_pkt.c @@ -428,7 +428,10 @@ printf("\n"); if (!clear) { /* !clear => s->read_hash != NULL => mac_size != -1 */ - mac_size=EVP_MD_CTX_size(s->read_hash); + int t; + t=EVP_MD_CTX_size(s->read_hash); + OPENSSL_assert(t >= 0); + mac_size=t; if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+mac_size) { @@ -453,7 +456,7 @@ printf("\n"); } rr->length-=mac_size; i=s->method->ssl3_enc->mac(s,md,0); - if (memcmp(md,&(rr->data[rr->length]),mac_size) != 0) + if (i < 0 || memcmp(md,&(rr->data[rr->length]),mac_size) != 0) { goto decryption_failed_or_bad_record_mac; } @@ -1341,7 +1344,11 @@ int do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len, if (clear) mac_size=0; else + { mac_size=EVP_MD_CTX_size(s->write_hash); + if (mac_size < 0) + goto err; + } /* DTLS implements explicit IV, so no need for empty fragments */ #if 0 @@ -1428,7 +1435,8 @@ int do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len, if (mac_size != 0) { - s->method->ssl3_enc->mac(s,&(p[wr->length + bs]),1); + if(s->method->ssl3_enc->mac(s,&(p[wr->length + bs]),1) < 0) + goto err; wr->length+=mac_size; } |