summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2023-03-07 05:37:27 +0000
committerDamien Miller <djm@cvs.openbsd.org>2023-03-07 05:37:27 +0000
commit0a4c0cb80de62498f64c914fdd66a14a6bd0d2f8 (patch)
treed8fd1131146e4ed4a35e57815b572d5b9421ff32
parent9e5bf547be0cb9196a1b59c6264694b87e6c4568 (diff)
fix memory leak in process_read() path; Spotted by James Robinson
in GHPR363; ok markus@
-rw-r--r--usr.bin/ssh/sftp-server.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/ssh/sftp-server.c b/usr.bin/ssh/sftp-server.c
index be2c3e7a0d3..ce966bcb980 100644
--- a/usr.bin/ssh/sftp-server.c
+++ b/usr.bin/ssh/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.
*
@@ -809,7 +809,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;
}