summaryrefslogtreecommitdiff
path: root/test/helpers
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-10-12 10:36:20 +0200
committerTomas Mraz <tomas@openssl.org>2022-10-21 18:02:35 +0200
commita8086e6bfc37355626393751a94bc5c92df7e9d3 (patch)
treed702fc114219808d8c123ef5284f3be1e84abecf /test/helpers
parentfba324204f3bdd8ba9e99d42db030aaf6482d896 (diff)
downloadopenssl-new-a8086e6bfc37355626393751a94bc5c92df7e9d3.tar.gz
stack: Do not add error if pop/shift/value accesses outside of the stack
This partially reverts commit 30eba7f35983a917f1007bce45040c0af3442e42. This is legitimate use of the stack functions and no error should be reported apart from the NULL return value. Fixes #19389 Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19400)
Diffstat (limited to 'test/helpers')
-rw-r--r--test/helpers/ssltestlib.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/test/helpers/ssltestlib.c b/test/helpers/ssltestlib.c
index 13564a08a7..727ba7ff6a 100644
--- a/test/helpers/ssltestlib.c
+++ b/test/helpers/ssltestlib.c
@@ -349,8 +349,7 @@ static int mempacket_test_read(BIO *bio, char *out, int outl)
unsigned int seq, offset, len, epoch;
BIO_clear_retry_flags(bio);
- if (sk_MEMPACKET_num(ctx->pkts) <= 0
- || (thispkt = sk_MEMPACKET_value(ctx->pkts, 0)) == NULL
+ if ((thispkt = sk_MEMPACKET_value(ctx->pkts, 0)) == NULL
|| thispkt->num != ctx->currpkt) {
/* Probably run out of data */
BIO_set_retry_read(bio);
@@ -603,9 +602,8 @@ int mempacket_test_inject(BIO *bio, const char *in, int inl, int pktnum,
ctx->lastpkt++;
do {
i++;
- if (i < sk_MEMPACKET_num(ctx->pkts)
- && (nextpkt = sk_MEMPACKET_value(ctx->pkts, i)) != NULL
- && nextpkt->num == ctx->lastpkt)
+ nextpkt = sk_MEMPACKET_value(ctx->pkts, i);
+ if (nextpkt != NULL && nextpkt->num == ctx->lastpkt)
ctx->lastpkt++;
else
return inl;