summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/password.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/common/password.c b/common/password.c
index a03e1dbff7..d157a11b7b 100644
--- a/common/password.c
+++ b/common/password.c
@@ -66,11 +66,14 @@ int password(unsigned char *passwd, size_t length, int flags, int timeout)
case CTL_CH('h'):
case KEY_DEL7:
case KEY_DEL:
- if (flags & STAR && pos > 0)
- puts("\b \b");
- *buf = '\0';
- buf--;
- pos--;
+ if (pos > 0) {
+ if (flags & STAR)
+ puts("\b \b");
+
+ *buf = '\0';
+ buf--;
+ pos--;
+ }
continue;
default:
if (pos < length - 1) {