mirror of
https://github.com/curl/curl.git
synced 2025-04-18 16:30:45 +08: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
@ -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…
x
Reference in New Issue
Block a user