libssh2/backport-session-support-server-banners-up-to-8192-bytes-was-256.patch
bitianyuan 9f753913aa backport some upstream patches
(cherry picked from commit 51fdb9be6c5591c0f02dbed57496dedbdcb12f3d)
2024-11-18 14:29:07 +08:00

39 lines
1.2 KiB
Diff

From 1a9e8811f7fa7538a52e2dd0150a094368471bf3 Mon Sep 17 00:00:00 2001
From: Anders Borum <palmin@users.noreply.github.com>
Date: Tue, 8 Oct 2024 08:11:02 +0200
Subject: [PATCH] session: support server banners up to 8192 bytes (was: 256)
If server had banner exceeding 256 bytes there wasn't enough room in
`_LIBSSH2_SESSION.banner_TxRx_banner`. Only the first 256 bytes would be
read making the first packet read fail but also dooming key exchange as
`session->remote.banner` didn't include everything.
This change bumps the banner buffer to 8KB to match OpenSSH.
Fixes #1442
Closes #1443
Reference:https://github.com/libssh2/libssh2/commit/1a9e8811f7fa7538a52e2dd0150a094368471bf3
Conflict:NA
---
src/libssh2_priv.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h
index ee1d8b5..b1f32b1 100644
--- a/src/libssh2_priv.h
+++ b/src/libssh2_priv.h
@@ -742,7 +742,7 @@ struct _LIBSSH2_SESSION
/* State variables used in libssh2_banner_send() */
libssh2_nonblocking_states banner_TxRx_state;
- char banner_TxRx_banner[256];
+ char banner_TxRx_banner[8192];
ssize_t banner_TxRx_total_send;
/* State variables used in libssh2_kexinit() */
--
2.43.0