1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-23 01:22:37 +03:00

Session.c : banner_receive() from leaking when accessing non ssh ports (#356)

File : session.c

Release previous banner in banner_receive() if the session is reused after a failed connection.

Credit : Ryan Kelley
This commit is contained in:
Ryan Kelley
2019-04-17 20:18:11 -04:00
committed by Will Cosgrove
parent 2b45dfcad7
commit 9d13d86627

View File

@@ -170,6 +170,9 @@ banner_receive(LIBSSH2_SESSION * session)
if(!banner_len)
return LIBSSH2_ERROR_BANNER_RECV;
if(session->remote.banner)
LIBSSH2_FREE(session, session->remote.banner);
session->remote.banner = LIBSSH2_ALLOC(session, banner_len + 1);
if(!session->remote.banner) {
return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,