[openssh-commits] [openssh] 02/02: upstream: Check return values from malloc.

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Jun 23 15:56:15 AEST 2026


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 512bfedf61129788d680210081e89843858dde85
Author: dtucker at openbsd.org <dtucker at openbsd.org>
AuthorDate: Mon Jun 22 12:28:48 2026 +0000

    upstream: Check return values from malloc.
    
    OpenBSD-Regress-ID: 28c8ab94a4fa5d047cec9c865b10bbf3c9ccf6d1
---
 regress/unittests/crypto/test_ed25519.c | 6 +++---
 regress/unittests/crypto/test_mldsa.c   | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/regress/unittests/crypto/test_ed25519.c b/regress/unittests/crypto/test_ed25519.c
index 14d123832..94a482ff2 100644
--- a/regress/unittests/crypto/test_ed25519.c
+++ b/regress/unittests/crypto/test_ed25519.c
@@ -1,4 +1,4 @@
-/* 	$OpenBSD: test_ed25519.c,v 1.3 2026/06/16 22:27:10 dtucker Exp $ */
+/* 	$OpenBSD: test_ed25519.c,v 1.4 2026/06/22 12:28:48 dtucker Exp $ */
 /*
  * Regress test for Ed25519 keypair from seed
  *
@@ -82,8 +82,8 @@ ed25519_tests(void)
 
 		TEST_START("Ed25519 sign/verify KAT");
 		msglen = strlen(ed25519_kats[i].msg) / 2;
-		msg = malloc(msglen + 64);
-		tmp = malloc(msglen + 64);
+		ASSERT_PTR_NE(msg = malloc(msglen + 64), NULL);
+		ASSERT_PTR_NE(tmp = malloc(msglen + 64), NULL);
 		hex2bin(msg + 64, ed25519_kats[i].msg, msglen);
 		hex2bin(expected_sig, ed25519_kats[i].sig, 64);
 
diff --git a/regress/unittests/crypto/test_mldsa.c b/regress/unittests/crypto/test_mldsa.c
index 4cbe8d5f8..5bbf1c43b 100644
--- a/regress/unittests/crypto/test_mldsa.c
+++ b/regress/unittests/crypto/test_mldsa.c
@@ -1,4 +1,4 @@
-/* 	$OpenBSD: test_mldsa.c,v 1.3 2026/06/16 22:27:10 dtucker Exp $ */
+/* 	$OpenBSD: test_mldsa.c,v 1.4 2026/06/22 12:28:48 dtucker Exp $ */
 /*
  * Regress test for ML-DSA
  *
@@ -117,7 +117,7 @@ mldsa_tests(void)
 		ASSERT_MEM_EQ(sk_hash, expected_sk_hash, 32);
 
 		msglen = strlen(kat->msg) / 2;
-		msg = malloc(msglen);
+		ASSERT_PTR_NE(msg = malloc(msglen), NULL);
 		hex2bin(msg, kat->msg, msglen);
 		hex2bin(rand, kat->rand, 32);
 		hex2bin(expected_sig_hash, kat->sig_hash, 32);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list