Ticket #104 (closed defect)

Opened 8 years ago

Last modified 8 years ago

Error using custom allocator in libssh2_session_init_ex

Reported by: markmcpherson Owned by: bagder
Priority: normal Milestone:
Component: API Version:
Keywords: Cc: markmcpherson, bagder
Blocked By: Blocks:

Description

The libssh2_session_init_ex allows you to specify custom memory allocation functions and a void *abstract arg. These functions are supposed to be called passing a ptr to the original abstract ptr arg (i.e. void abstract).

However, on the very first call, they are passed the abstract ptr itself rather than the doubly dereferenced pointer. This causes allocation code that utilizes that ptr to crash.

The source code for libssh2_session_init_ex includes the following:

session = local_alloc(sizeof(LIBSSH2_SESSION), abstract);

This should probably be changed to read

session = local_alloc(sizeof(LIBSSH2_SESSION), &abstract);

Change History

comment:1 Changed 8 years ago by bagder

Thanks, fixed in git now!

Note: See TracTickets for help on using tickets.