Skip to content

Commit

Permalink
bio chain test: ensure the length of empty chains is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
tb committed Dec 9, 2022
1 parent 9749f04 commit ab735ec
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/regress/lib/libcrypto/bio/bio_chain.c
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ab735ec

Please sign in to comment.