#220: agent_list_identities pointer to out of scope variable -------------------------------------+-------------------------------------- Reporter: madwizard.myopenid.com | Owner: Type: defect | Status: new Priority: normal | Milestone: 1.2.9 Component: API | Version: 1.2.8 Keywords: | Blocks: Blocked By: | -------------------------------------+-------------------------------------- In the windows version compiled with visual studio (I used 64-bit but 32-bit probably has the same problem) libssh2_agent_list_identitites may fail with LIBSSH2_ERROR_BAD_USE / "illegal agent request" even when used properly. I have tracked down the problem to agent_list_identities in agent.c where transctx->request is set as a pointer to a local uchar variable 'c' containing SSH2_AGENTC_REQUEST_IDENTITIES. The scope of this variable is the if-statement but the pointer will be used after the if statement and may be overwritten with other data placed on the stack. The problem was fixed by placing the local variable at the top of the function rather than in the if statement.
-- Ticket URL: <http://trac.libssh2.org/ticket/220> libssh2 <http://trac.libssh2.org/> C library for writing portable SSH2 clients _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel