Subject: [libssh2] [ libssh2-Bugs-1692274 ] libssh2_userauth_list returns a pointer to internal buffer

[libssh2] [ libssh2-Bugs-1692274 ] libssh2_userauth_list returns a pointer to internal buffer

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Thu, 28 Jun 2007 14:09:55 -0700

Bugs item #1692274, was opened at 2007-04-01 11:49
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=1692274&group_id=125852

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: API
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: sambira (sambira)
Assigned to: Nobody/Anonymous (nobody)
Summary: libssh2_userauth_list returns a pointer to internal buffer

Initial Comment:
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.

Thanks,

Mark Wick

----------------------------------------------------------------------

>Comment By: Daniel Stenberg (bagder)
Date: 2007-06-28 23:09

Message:
Logged In: YES
user_id=1110
Originator: NO

No, the returned string should NOT be freed by the application but is
handled by the library itself, as is now also mentioned in the man page
included in the 0.15 release.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=1692274&group_id=125852

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2007-06-28