Skip to content

Commit

Permalink
fix password not being cleared when blank_password is set
Browse files Browse the repository at this point in the history
  • Loading branch information
cylgom committed Feb 3, 2020
1 parent b2c1ef5 commit 2892559
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void config_load(const char *cfg_path)
{"asterisk", &config.asterisk, config_handle_char},
{"bg", &config.bg, config_handle_u8},
{"blank_box", &config.blank_box, config_handle_bool},
{"blank_password", &config.blank_box, config_handle_bool},
{"blank_password", &config.blank_password, config_handle_bool},
{"console_dev", &config.console_dev, config_handle_str},
{"default_input", &config.default_input, config_handle_u8},
{"fg", &config.fg, config_handle_u8},
Expand Down
8 changes: 8 additions & 0 deletions src/inputs.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,11 @@ void input_text_backspace(struct text* target)
input_text_delete(target);
}
}

void input_text_clear(struct text* target)
{
memset(target->text, 0, target->len + 1);
target->cur = target->text;
target->end = target->text;
target->visible_start = target->text;
}
1 change: 1 addition & 0 deletions src/inputs.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ void input_text_left(struct text* target);
void input_text_write(struct text* target, char ascii);
void input_text_delete(struct text* target);
void input_text_backspace(struct text* target);
void input_text_clear(struct text* target);

#endif
5 changes: 5 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ int main(int argc, char** argv)
buf.info_line = dgn_output_log();
}

if (config.blank_password)
{
input_text_clear(&password);
}

dgn_reset();
}
else
Expand Down

0 comments on commit 2892559

Please sign in to comment.