www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: [PATCH] agent_disconnect_unix: unset the agent fd after closing it

[PATCH] agent_disconnect_unix: unset the agent fd after closing it

From: Salvador Fandiño <sfandino_at_gmail.com>
Date: Sat, 5 Dec 2015 21:30:04 +0100

agent_disconnect_unix", called by "libssh2_agent_disconnect", was
leaving the file descriptor in the agent structure unchanged. Later,
"libssh2_agent_free" would call again "libssh2_agent_disconnect" under
the hood and it would try to close again the same file descriptor. In
most cases that resulted in just a harmless error, but it is also
possible that the file descriptor had been reused between the two
calls resulting in the closing of an unrelated file descriptor.

This patch sets agent->fd to LIBSSH2_INVALID_SOCKET avoiding that
issue.

Received on 2015-12-05

the libssh2 team