diff options
author | Tomas Mraz <tomas@openssl.org> | 2022-10-12 10:36:20 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-10-21 18:03:33 +0200 |
commit | 367ee2152e019d72f63537ae898eda311bc9219a (patch) | |
tree | cde4b048352703e8cc0ba8ed0ed58d4666887855 /test | |
parent | d8f0b0fc1fe520939c0a2ae1aafd394afcde4e55 (diff) |
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)
(cherry picked from commit a8086e6bfc37355626393751a94bc5c92df7e9d3)
Diffstat (limited to 'test')
-rw-r--r-- | test/helpers/ssltestlib.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/test/helpers/ssltestlib.c b/test/helpers/ssltestlib.c index 7dfb7befd0..4c17faea54 100644 --- a/test/helpers/ssltestlib.c +++ b/test/helpers/ssltestlib.c @@ -350,8 +350,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); @@ -521,9 +520,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; |