Skip to content

Commit 37d996b

Browse files
committed
upstream: Check return codes of sshbuf functions.
Fixes Coverity CIDs 405059 and 405061. OpenBSD-Regress-ID: defa55d32892172251bbd5efd15731ce55888247
1 parent 6c3c9f0 commit 37d996b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: test_sshbuf_getput_fuzz.c,v 1.5 2021/12/14 21:25:27 deraadt Exp $ */
1+
/* $OpenBSD: test_sshbuf_getput_fuzz.c,v 1.6 2025/09/25 22:17:29 dtucker Exp $ */
22
/*
33
* Regress test for sshbuf.h buffer API
44
*
@@ -47,22 +47,22 @@ attempt_parse_blob(u_char *blob, size_t len)
4747
p1 = sshbuf_new();
4848
ASSERT_PTR_NE(p1, NULL);
4949
ASSERT_INT_EQ(sshbuf_put(p1, blob, len), 0);
50-
sshbuf_get_u8(p1, &u8);
51-
sshbuf_get_u16(p1, &u16);
52-
sshbuf_get_u32(p1, &u32);
53-
sshbuf_get_u64(p1, &u64);
50+
ASSERT_INT_EQ(sshbuf_get_u8(p1, &u8), 0);
51+
ASSERT_INT_EQ(sshbuf_get_u16(p1, &u16), 0);
52+
ASSERT_INT_EQ(sshbuf_get_u32(p1, &u32), 0);
53+
ASSERT_INT_EQ(sshbuf_get_u64(p1, &u64), 0);
5454
if (sshbuf_get_string(p1, &s, &l) == 0) {
5555
bzero(s, l);
5656
free(s);
5757
}
5858
#ifdef WITH_OPENSSL
5959
bn = NULL;
60-
sshbuf_get_bignum2(p1, &bn);
60+
ASSERT_INT_EQ(sshbuf_get_bignum2(p1, &bn), 0);
6161
BN_clear_free(bn);
6262
#if defined(OPENSSL_HAS_ECC) && defined(OPENSSL_HAS_NISTP256)
6363
eck = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
6464
ASSERT_PTR_NE(eck, NULL);
65-
sshbuf_get_eckey(p1, eck);
65+
ASSERT_INT_EQ(sshbuf_get_eckey(p1, eck), 0);
6666
EC_KEY_free(eck);
6767
#endif /* defined(OPENSSL_HAS_ECC) && defined(OPENSSL_HAS_NISTP256) */
6868
#endif /* WITH_OPENSSL */

0 commit comments

Comments
 (0)