From: tb Date: Fri, 9 Dec 2022 07:47:59 +0000 (+0000) Subject: bio chain test: ensure the length of empty chains is 0 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=23b8a0e70fa22bde5db79a2acccbdf6d04b6ac19;p=openbsd bio chain test: ensure the length of empty chains is 0 --- 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 * @@ -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;