Ticket #27 (closed defect: fixed)
libssh2_userauth_list returns a pointer to internal buffer
|Reported by:||sambira||Owned by:||Viktor Szakats <vszakats@…>|
This API returns to the caller a buffer pointer that was allocated internally by the API and requires the user to free. This is not good when overloading the allocate functions and the allocate is different than the free. The API needs to require the user to either pass in a buffer to house the data or copy the data into their space or risk loosing the data. I would opt for the later where the API does not change but the semantics of operation do. The library API should then use an internal fixed buffer (maybe a stack buffer) to wearhouse the data and pass that pointer. When the function is done, the data is gone. Another option is to have the session structure contain a buffer for this information which the user can access since they have the pointer to the session buffer and the structure access to reference data from there (maybe provide a MACRO to access the information). Just some thoughts.