mirror of
https://github.com/troglobit/editline.git
synced 2025-05-06 12:31:45 +08:00
Fix el_no_echo bug leaking secrets to screen and history
This patch makes el_no_echo actually work: - Don't echo to screen - Don't save to history Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
7330f21c28
commit
29b7f91165
@ -167,6 +167,9 @@ static void tty_flush(void)
|
||||
|
||||
static void tty_put(const char c)
|
||||
{
|
||||
if (el_no_echo)
|
||||
return;
|
||||
|
||||
Screen[ScreenCount] = c;
|
||||
if (++ScreenCount >= ScreenSize - 1) {
|
||||
ScreenSize += SCREEN_INC;
|
||||
@ -1180,9 +1183,11 @@ char *readline(const char *prompt)
|
||||
free(Screen);
|
||||
free(H.Lines[--H.Size]);
|
||||
|
||||
/* Always add history, if it's a sane line. */
|
||||
if (line != NULL && *line != '\0')
|
||||
hist_add(line);
|
||||
/* Add to history, unless no-echo mode ... */
|
||||
if (!el_no_echo) {
|
||||
if (line != NULL && *line != '\0')
|
||||
hist_add(line);
|
||||
}
|
||||
|
||||
if (el_intr_pending > 0) {
|
||||
int s = el_intr_pending;
|
||||
|
Loading…
Reference in New Issue
Block a user