summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2022-09-19 09:57:38 +1000
committerHugo Landau <hlandau@openssl.org>2022-09-21 14:16:47 +0100
commit33796db4a5c3ea68ae80530dcbff60222c5a2008 (patch)
tree7cc1b871de216f9a8d50411ef15216fdceee86ce
parentff9b1fe302c2c5022f35ad3b78f05080ff4908da (diff)
Coverity 1515415: NULL dereference
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19236) (cherry picked from commit 82d46d14462491681f25d016508715e85c1dc4d1)
-rw-r--r--test/helpers/ssltestlib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/helpers/ssltestlib.c b/test/helpers/ssltestlib.c
index 24df80e0e9..51740f3599 100644
--- a/test/helpers/ssltestlib.c
+++ b/test/helpers/ssltestlib.c
@@ -504,7 +504,8 @@ int mempacket_test_inject(BIO *bio, const char *in, int inl, int pktnum,
}
for (i = 0; i < sk_MEMPACKET_num(ctx->pkts); i++) {
- looppkt = sk_MEMPACKET_value(ctx->pkts, i);
+ if (!TEST_ptr(looppkt = sk_MEMPACKET_value(ctx->pkts, i)))
+ goto err;
/* Check if we found the right place to insert this packet */
if (looppkt->num > thispkt->num) {
if (sk_MEMPACKET_insert(ctx->pkts, thispkt, i) == 0)