Skip to content

Commit ab735ec

Browse files
author
tb
committed
bio chain test: ensure the length of empty chains is 0
1 parent 9749f04 commit ab735ec

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/regress/lib/libcrypto/bio/bio_chain.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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 $ */
22
/*
33
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
44
*
@@ -200,8 +200,11 @@ walk_forward(BIO *start, BIO *end, size_t expected_len, size_t i, size_t j,
200200
size_t len;
201201
int ret = 0;
202202

203-
if (start == NULL || end == NULL)
203+
if (start == NULL || end == NULL) {
204+
if (expected_len != 0)
205+
goto err;
204206
goto done;
207+
}
205208

206209
next = start;
207210
len = 0;
@@ -240,8 +243,11 @@ walk_backward(BIO *start, BIO *end, size_t expected_len, size_t i, size_t j,
240243
size_t len;
241244
int ret = 0;
242245

243-
if (start == NULL || end == NULL)
246+
if (start == NULL || end == NULL) {
247+
if (expected_len != 0)
248+
goto err;
244249
goto done;
250+
}
245251

246252
prev = end;
247253
len = 0;

0 commit comments

Comments
 (0)