-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libssh2_userauth_keyboard_interactive_ex callback and memory allocation #1078
Labels
Comments
bagder
added a commit
to curl/curl
that referenced
this issue
Jun 1, 2023
Because of how libssh2_userauth_keyboard_interactive_ex() works: the libcurl callback allocates memory that is later free()d by libssh2, we must set the custom memory functions. Reverts 8b5f100 Ref: libssh2/libssh2#1078
It's surely confusing and non-obvious, but unless we want to change the API to never free() or return allocated pointers (to be freed by callers), we might make this gotcha clearer in the docs. |
Yeah, I don't think we can fix this without adding a replacement function, and until someone wants to work on that I think clarifying this caveat in the documentation is the next best thing. At least there is a functioning workaround! |
bagder
added a commit
to curl/curl
that referenced
this issue
Jun 1, 2023
Because of how libssh2_userauth_keyboard_interactive_ex() works: the libcurl callback allocates memory that is later free()d by libssh2, we must set the custom memory functions. Reverts 8b5f100 Ref: libssh2/libssh2#1078 Closes #11235
bch
pushed a commit
to bch/curl
that referenced
this issue
Jul 19, 2023
Because of how libssh2_userauth_keyboard_interactive_ex() works: the libcurl callback allocates memory that is later free()d by libssh2, we must set the custom memory functions. Reverts 8b5f100 Ref: libssh2/libssh2#1078 Closes curl#11235
ptitSeb
pushed a commit
to wasix-org/curl
that referenced
this issue
Sep 25, 2023
Because of how libssh2_userauth_keyboard_interactive_ex() works: the libcurl callback allocates memory that is later free()d by libssh2, we must set the custom memory functions. Reverts 8b5f100 Ref: libssh2/libssh2#1078 Closes curl#11235
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The function
libssh2_userauth_keyboard_interactive_ex
calls a function in the app to return a set of passwords.These passwords are documented as:
String values will be free(3)ed by the library
.This is a problem on (for example) Windows when libssh2 is used as a DLL, as then they use memory models that cannot be shared between an application and the DLL.
This happens on git master and this issue has probably always existed. It can be circumvented by providing custom memory functions using
libssh2_session_init_ex
.The text was updated successfully, but these errors were encountered: