summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2022-12-09 07:48:00 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2022-12-09 07:48:00 +0000
commit125092c5871e68c02837a35ef9e7e61cf8756646 (patch)
tree118f5b70c6793e49ccdc55527effd36bb0945199
parenteed3f0b2d7dd52a97e33e2b56f38f40e0096aeb0 (diff)
bio chain test: ensure the length of empty chains is 0
-rw-r--r--regress/lib/libcrypto/bio/bio_chain.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/regress/lib/libcrypto/bio/bio_chain.c b/regress/lib/libcrypto/bio/bio_chain.c
index 81b3b862f70..81f9b820409 100644
--- a/regress/lib/libcrypto/bio/bio_chain.c
+++ b/regress/lib/libcrypto/bio/bio_chain.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bio_chain.c,v 1.8 2022/12/09 07:46:54 tb Exp $ */
+/* $OpenBSD: bio_chain.c,v 1.9 2022/12/09 07:47:59 tb Exp $ */
/*
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
*
@@ -200,8 +200,11 @@ walk_forward(BIO *start, BIO *end, size_t expected_len, size_t i, size_t j,
size_t len;
int ret = 0;
- if (start == NULL || end == NULL)
+ if (start == NULL || end == NULL) {
+ if (expected_len != 0)
+ goto err;
goto done;
+ }
next = start;
len = 0;
@@ -240,8 +243,11 @@ walk_backward(BIO *start, BIO *end, size_t expected_len, size_t i, size_t j,
size_t len;
int ret = 0;
- if (start == NULL || end == NULL)
+ if (start == NULL || end == NULL) {
+ if (expected_len != 0)
+ goto err;
goto done;
+ }
prev = end;
len = 0;