[openssh-commits] [openssh] 02/02: upstream: fix memory leak in process_read() path; Spotted by James

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Mar 7 16:39:49 AEDT 2023


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

djm pushed a commit to branch master
in repository openssh.

commit 3f9231c2e1f374ebb08016ba00ea97b47c0ed20b
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Tue Mar 7 05:37:26 2023 +0000

    upstream: fix memory leak in process_read() path; Spotted by James
    
    Robinson in GHPR363; ok markus@
    
    OpenBSD-Commit-ID: cdc2d98e6478b7e7f3a36976845adae3820429d8
---
 sftp-server.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sftp-server.c b/sftp-server.c
index fe61a351..49ca1ca9 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-server.c,v 1.145 2022/11/09 09:04:12 dtucker Exp $ */
+/* $OpenBSD: sftp-server.c,v 1.146 2023/03/07 05:37:26 djm Exp $ */
 /*
  * Copyright (c) 2000-2004 Markus Friedl.  All rights reserved.
  *
@@ -819,7 +819,7 @@ process_read(u_int32_t id)
 	}
 	if (len > buflen) {
 		debug3_f("allocate %zu => %u", buflen, len);
-		if ((buf = realloc(NULL, len)) == NULL)
+		if ((buf = realloc(buf, len)) == NULL)
 			fatal_f("realloc failed");
 		buflen = len;
 	}

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


More information about the openssh-commits mailing list