diff options
author | Doug Hogan <doug@cvs.openbsd.org> | 2014-10-18 03:04:29 +0000 |
---|---|---|
committer | Doug Hogan <doug@cvs.openbsd.org> | 2014-10-18 03:04:29 +0000 |
commit | 7a7f4302a87b8f5db4f5b202649ea5e3fa7d0f57 (patch) | |
tree | c276749280f80e071d5ab1b2ad5aefd92cd690b7 /lib | |
parent | f0b7c7f450a8f8c244d7bf2f74514c68b5663251 (diff) |
Typical malloc() with size multiplication to reallocarray().
ok deraadt@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libssl/t1_enc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libssl/t1_enc.c b/lib/libssl/t1_enc.c index 6ad721bd8ae..a62d7a939c8 100644 --- a/lib/libssl/t1_enc.c +++ b/lib/libssl/t1_enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t1_enc.c,v 1.69 2014/08/07 20:02:23 miod Exp $ */ +/* $OpenBSD: t1_enc.c,v 1.70 2014/10/18 03:04:28 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -603,14 +603,14 @@ tls1_setup_key_block(SSL *s) s->s3->tmp.new_mac_pkey_type = mac_type; s->s3->tmp.new_mac_secret_size = mac_secret_size; - key_block_len = (mac_secret_size + key_len + iv_len) * 2; - ssl3_cleanup_key_block(s); - if ((key_block = malloc(key_block_len)) == NULL) { + if ((key_block = reallocarray(NULL, mac_secret_size + key_len + iv_len, + 2)) == NULL) { SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE); goto err; } + key_block_len = (mac_secret_size + key_len + iv_len) * 2; s->s3->tmp.key_block_length = key_block_len; s->s3->tmp.key_block = key_block; |