[openssh-commits] [openssh] 02/02: upstream: Plug leak in ssh_digest_memory on error path.

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Dec 16 20:41:46 AEDT 2025


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

dtucker pushed a commit to branch master
in repository openssh.

commit f878d7ccc25b02a39e6766f5dd405d5de6fb106c
Author: dtucker at openbsd.org <dtucker at openbsd.org>
AuthorDate: Tue Dec 16 08:36:43 2025 +0000

    upstream: Plug leak in ssh_digest_memory on error path.
    
    Bonehead mistake spotted by otto@, ok djm@
    
    OpenBSD-Commit-ID: 4ad67ac402e0b4c013f4f4e386d22b88969a5dd7
---
 digest-libc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/digest-libc.c b/digest-libc.c
index b187bc9fa..6e62af7f2 100644
--- a/digest-libc.c
+++ b/digest-libc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: digest-libc.c,v 1.8 2025/09/05 09:31:31 dtucker Exp $ */
+/* $OpenBSD: digest-libc.c,v 1.9 2025/12/16 08:36:43 dtucker Exp $ */
 /*
  * Copyright (c) 2013 Damien Miller <djm at mindrot.org>
  * Copyright (c) 2014 Markus Friedl.  All rights reserved.
@@ -248,14 +248,15 @@ int
 ssh_digest_memory(int alg, const void *m, size_t mlen, u_char *d, size_t dlen)
 {
 	struct ssh_digest_ctx *ctx = ssh_digest_start(alg);
+	int ret = 0;
 
 	if (ctx == NULL)
 		return SSH_ERR_INVALID_ARGUMENT;
 	if (ssh_digest_update(ctx, m, mlen) != 0 ||
 	    ssh_digest_final(ctx, d, dlen) != 0)
-		return SSH_ERR_INVALID_ARGUMENT;
+		ret = SSH_ERR_INVALID_ARGUMENT;
 	ssh_digest_free(ctx);
-	return 0;
+	return ret;
 }
 
 int

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


More information about the openssh-commits mailing list