mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-08 09:14:22 +01:00
If the prompt is hidden or a password is sent with -U, zero it before freeing
it.
This commit is contained in:
parent
f031975dc0
commit
50bd094856
@ -278,13 +278,14 @@ server_msg_fn_unlock(struct hdr *hdr, struct client *c)
|
||||
if (server_unlock(pass) != 0) {
|
||||
#define MSG "bad password"
|
||||
server_write_client(c, MSG_ERROR, MSG, (sizeof MSG) - 1);
|
||||
server_write_client(c, MSG_EXIT, NULL, 0);
|
||||
return (0);
|
||||
#undef MSG
|
||||
}
|
||||
|
||||
server_write_client(c, MSG_EXIT, NULL, 0);
|
||||
|
||||
memset(pass, 0, strlen(pass));
|
||||
xfree(pass);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
6
status.c
6
status.c
@ -597,6 +597,8 @@ status_prompt_clear(struct client *c)
|
||||
xfree(c->prompt_string);
|
||||
c->prompt_string = NULL;
|
||||
|
||||
if (c->prompt_flags & PROMPT_HIDDEN)
|
||||
memset(c->prompt_buffer, 0, strlen(c->prompt_buffer));
|
||||
xfree(c->prompt_buffer);
|
||||
c->prompt_buffer = NULL;
|
||||
|
||||
@ -794,6 +796,8 @@ status_prompt_key(struct client *c, int key)
|
||||
|
||||
if (ARRAY_LENGTH(&c->prompt_hdata) == 0)
|
||||
break;
|
||||
if (c->prompt_flags & PROMPT_HIDDEN)
|
||||
memset(c->prompt_buffer, 0, strlen(c->prompt_buffer));
|
||||
xfree(c->prompt_buffer);
|
||||
|
||||
c->prompt_buffer = xstrdup(ARRAY_ITEM(&c->prompt_hdata,
|
||||
@ -808,6 +812,8 @@ status_prompt_key(struct client *c, int key)
|
||||
if (server_locked)
|
||||
break;
|
||||
|
||||
if (c->prompt_flags & PROMPT_HIDDEN)
|
||||
memset(c->prompt_buffer, 0, strlen(c->prompt_buffer));
|
||||
xfree(c->prompt_buffer);
|
||||
|
||||
if (c->prompt_hindex != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user