mirror of
https://github.com/curl/curl.git
synced 2026-04-20 05:01:14 +03:00
libssh2: allocate libssh2-friendly memory in kbd_callback
The function libssh2_userauth_keyboard_interactive_ex() calls the callback and is documented to call free() on the memory returned to libssh2 from the callback. libcurl can therefore not use the regular curlx_strdup() for this, as that is not compatible in debug builds or when curl_global_init_mem() is used. Fixes #21336 Closes #21338
This commit is contained in:
parent
548c16a824
commit
7e450cb80a
1 changed files with 3 additions and 1 deletions
|
|
@ -148,7 +148,9 @@ static void kbd_callback(const char *name, int name_len,
|
|||
#endif /* CURL_LIBSSH2_DEBUG */
|
||||
if(num_prompts == 1) {
|
||||
struct connectdata *conn = data->conn;
|
||||
responses[0].text = curlx_strdup(conn->passwd);
|
||||
/* this function must allocate memory that can be freed by libssh2, which
|
||||
uses the LIBSSH2_FREE_FUNC callback */
|
||||
responses[0].text = Curl_cstrdup(conn->passwd);
|
||||
responses[0].length =
|
||||
responses[0].text == NULL ? 0 : curlx_uztoui(strlen(conn->passwd));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue