aboutsummaryrefslogtreecommitdiff
path: root/test/ssltestlib.c
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2019-01-08 16:27:27 +1000
committerPauli <paul.dale@oracle.com>2019-01-08 16:27:27 +1000
commit760e2d60e62511a6fb96f547f6730d05eb5f47ec (patch)
treee7b3f944577aa84628371a6e20b97988e2e4f802 /test/ssltestlib.c
parentdf1f538f28c10f2954757164b17781040d2355ef (diff)
downloadopenssl-760e2d60e62511a6fb96f547f6730d05eb5f47ec.zip
openssl-760e2d60e62511a6fb96f547f6730d05eb5f47ec.tar.gz
openssl-760e2d60e62511a6fb96f547f6730d05eb5f47ec.tar.bz2
Fix CID 1434549: Unchecked return value in test/evp_test.c
5. check_return: Calling EVP_EncodeUpdate without checking return value (as is done elsewhere 4 out of 5 times). Fix CID 1371695, 1371698: Resource leak in test/evp_test.c - leaked_storage: Variable edata going out of scope leaks the storage it points to. - leaked_storage: Variable encode_ctx going out of scope leaks the storage it points to Fix CID 1430437, 1430426, 1430429 : Dereference before null check in test/drbg_cavs_test.c check_after_deref: Null-checking drbg suggests that it may be null, but it has already been dereferenced on all paths leading to the check Fix CID 1440765: Dereference before null check in test/ssltestlib.c check_after_deref: Null-checking ctx suggests that it may be null, but it has already been dereferenced on all paths leading to the check. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/7993)
Diffstat (limited to 'test/ssltestlib.c')
-rw-r--r--test/ssltestlib.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/ssltestlib.c b/test/ssltestlib.c
index 8187513..78c0e8e 100644
--- a/test/ssltestlib.c
+++ b/test/ssltestlib.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -436,7 +436,7 @@ int mempacket_test_inject(BIO *bio, const char *in, int inl, int pktnum,
{
MEMPACKET_TEST_CTX *ctx = BIO_get_data(bio);
MEMPACKET *thispkt = NULL, *looppkt, *nextpkt, *allpkts[3];
- int i, duprec = ctx->duprec > 0;
+ int i, duprec;
const unsigned char *inu = (const unsigned char *)in;
size_t len = ((inu[RECORD_LEN_HI] << 8) | inu[RECORD_LEN_LO])
+ DTLS1_RT_HEADER_LENGTH;
@@ -449,6 +449,8 @@ int mempacket_test_inject(BIO *bio, const char *in, int inl, int pktnum,
if ((size_t)inl == len)
duprec = 0;
+ else
+ duprec = ctx->duprec > 0;
/* We don't support arbitrary injection when duplicating records */
if (duprec && pktnum != -1)