From: Lennart Poettering Date: Tue, 25 Mar 2014 00:27:05 +0000 (+0100) Subject: ask-password: when the user types a overly long password, beep and refuse X-Git-Tag: v212~13 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=036eeac5a1799fa2c0ae11a14d8c667b5d303189;p=elogind.git ask-password: when the user types a overly long password, beep and refuse Based on a similar patch from David Härdeman. --- diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index 117f0c668..96f16cc7f 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)