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)
|
static void tty_put(const char c)
|
||||||
{
|
{
|
||||||
|
if (el_no_echo)
|
||||||
|
return;
|
||||||
|
|
||||||
Screen[ScreenCount] = c;
|
Screen[ScreenCount] = c;
|
||||||
if (++ScreenCount >= ScreenSize - 1) {
|
if (++ScreenCount >= ScreenSize - 1) {
|
||||||
ScreenSize += SCREEN_INC;
|
ScreenSize += SCREEN_INC;
|
||||||
@ -1180,9 +1183,11 @@ char *readline(const char *prompt)
|
|||||||
free(Screen);
|
free(Screen);
|
||||||
free(H.Lines[--H.Size]);
|
free(H.Lines[--H.Size]);
|
||||||
|
|
||||||
/* Always add history, if it's a sane line. */
|
/* Add to history, unless no-echo mode ... */
|
||||||
|
if (!el_no_echo) {
|
||||||
if (line != NULL && *line != '\0')
|
if (line != NULL && *line != '\0')
|
||||||
hist_add(line);
|
hist_add(line);
|
||||||
|
}
|
||||||
|
|
||||||
if (el_intr_pending > 0) {
|
if (el_intr_pending > 0) {
|
||||||
int s = el_intr_pending;
|
int s = el_intr_pending;
|
||||||
|
Loading…
Reference in New Issue
Block a user