diff options
author | tb <> | 2022-12-09 07:47:59 +0000 |
---|---|---|
committer | tb <> | 2022-12-09 07:47:59 +0000 |
commit | 134447f29ef741b5bfa3f913e73676fa2ea47af9 (patch) | |
tree | 1cc589a9329eb150eaaeef307e8cca3996911d60 | |
parent | 7d30ffa93de4af659f4d19a6c9e1561e462428fc (diff) | |
download | openbsd-134447f29ef741b5bfa3f913e73676fa2ea47af9.tar.gz openbsd-134447f29ef741b5bfa3f913e73676fa2ea47af9.tar.bz2 openbsd-134447f29ef741b5bfa3f913e73676fa2ea47af9.zip |
bio chain test: ensure the length of empty chains is 0
-rw-r--r-- | src/regress/lib/libcrypto/bio/bio_chain.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/regress/lib/libcrypto/bio/bio_chain.c b/src/regress/lib/libcrypto/bio/bio_chain.c index 81b3b862f7..81f9b82040 100644 --- a/src/regress/lib/libcrypto/bio/bio_chain.c +++ b/src/regress/lib/libcrypto/bio/bio_chain.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_chain.c,v 1.8 2022/12/09 07:46:54 tb Exp $ */ | 1 | /* $OpenBSD: bio_chain.c,v 1.9 2022/12/09 07:47:59 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> |
4 | * | 4 | * |
@@ -200,8 +200,11 @@ walk_forward(BIO *start, BIO *end, size_t expected_len, size_t i, size_t j, | |||
200 | size_t len; | 200 | size_t len; |
201 | int ret = 0; | 201 | int ret = 0; |
202 | 202 | ||
203 | if (start == NULL || end == NULL) | 203 | if (start == NULL || end == NULL) { |
204 | if (expected_len != 0) | ||
205 | goto err; | ||
204 | goto done; | 206 | goto done; |
207 | } | ||
205 | 208 | ||
206 | next = start; | 209 | next = start; |
207 | len = 0; | 210 | len = 0; |
@@ -240,8 +243,11 @@ walk_backward(BIO *start, BIO *end, size_t expected_len, size_t i, size_t j, | |||
240 | size_t len; | 243 | size_t len; |
241 | int ret = 0; | 244 | int ret = 0; |
242 | 245 | ||
243 | if (start == NULL || end == NULL) | 246 | if (start == NULL || end == NULL) { |
247 | if (expected_len != 0) | ||
248 | goto err; | ||
244 | goto done; | 249 | goto done; |
250 | } | ||
245 | 251 | ||
246 | prev = end; | 252 | prev = end; |
247 | len = 0; | 253 | len = 0; |