diff options
author | jsing <> | 2018-11-10 01:34:02 +0000 |
---|---|---|
committer | jsing <> | 2018-11-10 01:34:02 +0000 |
commit | be4fa1561c45b4bddcbc9269f62bda323feefa75 (patch) | |
tree | 23cf39a6efa8bbe9327ef65101f141d8e7b8c643 | |
parent | 1dd4b0628e51e31516f047e02f51b266d74539df (diff) | |
download | openbsd-be4fa1561c45b4bddcbc9269f62bda323feefa75.tar.gz openbsd-be4fa1561c45b4bddcbc9269f62bda323feefa75.tar.bz2 openbsd-be4fa1561c45b4bddcbc9269f62bda323feefa75.zip |
Avoid a double allocation and memory leak.
Reported by Ben L <bobsayshilol at live dot co dot uk>
-rw-r--r-- | src/lib/libssl/tls13_key_schedule.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/lib/libssl/tls13_key_schedule.c b/src/lib/libssl/tls13_key_schedule.c index 25c183fbb0..af273d6d27 100644 --- a/src/lib/libssl/tls13_key_schedule.c +++ b/src/lib/libssl/tls13_key_schedule.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_key_schedule.c,v 1.5 2018/11/10 00:18:25 beck Exp $ */ | 1 | /* $OpenBSD: tls13_key_schedule.c,v 1.6 2018/11/10 01:34:02 jsing Exp $ */ |
2 | /* Copyright (c) 2018, Bob Beck <beck@openbsd.org> | 2 | /* Copyright (c) 2018, Bob Beck <beck@openbsd.org> |
3 | * | 3 | * |
4 | * Permission to use, copy, modify, and/or distribute this software for any | 4 | * Permission to use, copy, modify, and/or distribute this software for any |
@@ -80,6 +80,7 @@ tls13_secrets_create(const EVP_MD *digest, int resumption) | |||
80 | 80 | ||
81 | if ((secrets = calloc(1, sizeof(struct tls13_secrets))) == NULL) | 81 | if ((secrets = calloc(1, sizeof(struct tls13_secrets))) == NULL) |
82 | goto err; | 82 | goto err; |
83 | |||
83 | if ((secrets->zeros.data = calloc(hash_length, sizeof(uint8_t))) == | 84 | if ((secrets->zeros.data = calloc(hash_length, sizeof(uint8_t))) == |
84 | NULL) | 85 | NULL) |
85 | goto err; | 86 | goto err; |
@@ -108,9 +109,6 @@ tls13_secrets_create(const EVP_MD *digest, int resumption) | |||
108 | if ((secrets->extracted_handshake.data = malloc(hash_length)) == NULL) | 109 | if ((secrets->extracted_handshake.data = malloc(hash_length)) == NULL) |
109 | goto err; | 110 | goto err; |
110 | secrets->extracted_handshake.len = hash_length; | 111 | secrets->extracted_handshake.len = hash_length; |
111 | if ((secrets->extracted_handshake.data = malloc(hash_length)) == NULL) | ||
112 | goto err; | ||
113 | secrets->extracted_handshake.len = hash_length; | ||
114 | if ((secrets->client_handshake_traffic.data = malloc(hash_length)) | 112 | if ((secrets->client_handshake_traffic.data = malloc(hash_length)) |
115 | == NULL) | 113 | == NULL) |
116 | goto err; | 114 | goto err; |