[PATCH 3/5] login: check return value of digest_alloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



digest_alloc can fail, check the return value.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 common/password.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/password.c b/common/password.c
index 0cb79b8..43c5e0c 100644
--- a/common/password.c
+++ b/common/password.c
@@ -288,6 +288,10 @@ static int check_passwd(unsigned char *passwd, size_t length)
 		hash_len = PBKDF2_LENGTH;
 	} else {
 		d = digest_alloc(PASSWD_SUM);
+		if (!d) {
+			pr_err("No such digest: %s\n", PASSWD_SUM);
+			return -ENOENT;
+		}
 
 		hash_len = digest_length(d);
 	}
-- 
2.5.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux