1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-10-29 00:54:50 +03:00

packet: authagent_open: fix failure packet length (#1701)

Compute packet_len using strlen(AuthAgentUnavail) (not X11FwdUnAvil).
The mismatch could send 1 uninitialized byte on the wire.

Credit:
Joshua Rogers
This commit is contained in:
Joshua Rogers
2025-10-10 01:18:53 +08:00
committed by GitHub
parent 13a7145184
commit 31ec5a8b55

View File

@@ -464,7 +464,7 @@ packet_authagent_open(LIBSSH2_SESSION * session,
{
uint32_t failure_code = SSH_OPEN_CONNECT_FAILED;
/* 17 = packet_type(1) + channel(4) + reason(4) + descr(4) + lang(4) */
size_t packet_len = 17 + strlen(X11FwdUnAvil);
size_t packet_len = 17 + strlen(AuthAgentUnavail);
unsigned char *p;
LIBSSH2_CHANNEL *channel = authagent_state->channel;
int rc;