reality: fix leak of ClientHello init buffer in reality_server_start_relay
This commit is contained in:
1 parent
3032066d8c
commit
6777c7173d
2 files changed
+3
-3
No files matched your search
@@ -20,7 +20,7 @@ struct UASYNC;
|
||||
// Начать релей. Забирает владение client_sock (non-blocking, зарегистрирован
|
||||
// в uasync) и проксирует его на dest ("host:port").
|
||||
// initial_data/initial_len — уже прочитанные байты от клиента (ClientHello),
|
||||
// отправляются на dest первыми (буфер переходит во владение модуля).
|
||||
// отправляются на dest первыми (буфер КОПИРУЕТСЯ — владение остаётся у вызывающего).
|
||||
// Возвращает 0 = ok, -1 = ошибка (client_sock уже закрыт внутри).
|
||||
int reality_relay_start(struct UASYNC *ua, socket_t client_sock,
|
||||
const char *dest,
|
||||
|
||||
@@ -203,8 +203,8 @@ static void reality_server_start_relay(struct stcp_conn *c,
|
||||
c->socket_id = NULL;
|
||||
c->sock = SOCKET_INVALID;
|
||||
|
||||
if (reality_relay_start(c->ua, cli_sock, c->reality_dest, init, init_len) != 0)
|
||||
u_free(init);
|
||||
reality_relay_start(c->ua, cli_sock, c->reality_dest, init, init_len);
|
||||
u_free(init); /* reality_relay_start копирует данные в свой буфер — владение остаётся у нас */
|
||||
stcp_conn_do_close(c, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user