diff options
author | Tobias Stoeckmann <tobias@stoeckmann.org> | 2017-03-25 21:16:01 +0100 |
---|---|---|
committer | Markus Teich <teichm@fs.tum.de> | 2017-03-25 21:51:29 +0100 |
commit | 35633d45672d14bd798c478c45d1a17064701aa9 (patch) | |
tree | cfd18c8b5ddb6738b59174cf91a9a8421ac48713 | |
parent | 2d2a21a90ad1b53594b1b90b97486189ec54afce (diff) |
Properly clear the last entered character
When enter is pressed, passwd[len] will be set to '\0'. Pressing
backspace is supposed to remove the last entered character.
But currently, the clearing has an off-by-one, as in setting
passwd[len] to '\0' just like enter would do.
You can also verify it by imagining len=1 and that it's impossible to
clear passwd[0] by pressing backspace with the current code.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
-rw-r--r-- | slock.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -177,7 +177,7 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, | |||
177 | break; | 177 | break; |
178 | case XK_BackSpace: | 178 | case XK_BackSpace: |
179 | if (len) | 179 | if (len) |
180 | passwd[len--] = '\0'; | 180 | passwd[--len] = '\0'; |
181 | break; | 181 | break; |
182 | default: | 182 | default: |
183 | if (num && !iscntrl((int)buf[0]) && | 183 | if (num && !iscntrl((int)buf[0]) && |