[hackers] [slock] error out early on crypt() fail || Markus Teich

From: <git_AT_suckless.org>
Date: Fri, 23 Sep 2016 19:08:06 +0200 (CEST)

commit a98fba8971ab4b8d8b1f18422b808a79434d8923
Author: Markus Teich <markus.teich_AT_stusta.mhn.de>
AuthorDate: Fri Sep 23 19:08:39 2016 +0200
Commit: Markus Teich <markus.teich_AT_stusta.mhn.de>
CommitDate: Fri Sep 23 19:08:39 2016 +0200

    error out early on crypt() fail

diff --git a/slock.c b/slock.c
index 6dedc69..2d57e81 100644
--- a/slock.c
+++ b/slock.c
_AT_@ -321,8 +321,9 @@ main(int argc, char **argv) {
 #endif
 
         hash = gethash();
- if (strlen(hash) < 2)
- die("slock: failed to get user password hash.\n");
+ errno = 0;
+ if (!crypt("", hash))
+ die("slock: crypt: %s\n", strerror(errno));
 
         if (!(dpy = XOpenDisplay(NULL)))
                 die("slock: cannot open display\n");
Received on Fri Sep 23 2016 - 19:08:06 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 23 2016 - 19:12:15 CEST