diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-03-25 01:27:05 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-03-25 01:27:45 +0100 |
commit | 036eeac5a1799fa2c0ae11a14d8c667b5d303189 (patch) | |
tree | 5e3976fba77495e734f0472913146a62f3d9c712 /src | |
parent | af7424af70d063412c09b0125f4d4a39865210dc (diff) |
ask-password: when the user types a overly long password, beep and refuse
Based on a similar patch from David Härdeman.
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/ask-password-api.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index 117f0c6687..96f16cc7f8 100644 --- a/src/shared/ask-password-api.c +++ b/src/shared/ask-password-api.c @@ -207,6 +207,11 @@ int ask_password_tty( if (ttyfd >= 0) loop_write(ttyfd, "(no echo) ", 10, false); } else { + if (p >= sizeof(passphrase)-1) { + loop_write(ttyfd, "\a", 1, false); + continue; + } + passphrase[p++] = c; if (!silent_mode && ttyfd >= 0) |