mirror of
https://github.com/curl/curl.git
synced 2026-05-03 08:27:51 +03:00
libssh2: set length to 0 if strdup failed
Internally, libssh2 dereferences the NULL pointer if length is non-zero. The callback function cannot return the error condition, so at least prevent subsequent crash. Closes #13213
This commit is contained in:
parent
4ad9d29705
commit
6f32048200
1 changed files with 2 additions and 1 deletions
|
|
@ -201,7 +201,8 @@ kbd_callback(const char *name, int name_len, const char *instruction,
|
|||
if(num_prompts == 1) {
|
||||
struct connectdata *conn = data->conn;
|
||||
responses[0].text = strdup(conn->passwd);
|
||||
responses[0].length = curlx_uztoui(strlen(conn->passwd));
|
||||
responses[0].length =
|
||||
responses[0].text == NULL ? 0 : curlx_uztoui(strlen(conn->passwd));
|
||||
}
|
||||
(void)prompts;
|
||||
} /* kbd_callback */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue