diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-08-27 16:01:11 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-08-28 08:00:30 +0200 |
commit | 3e361f37643bfaea1b1bc06ab9767b2755deec21 (patch) | |
tree | 8bb1773c0c5a8559fb7ebb8938e6004a318fda77 /common | |
parent | 40596b856f61c281fb34f804bf42550c099f26c3 (diff) | |
download | barebox-3e361f37643bfaea1b1bc06ab9767b2755deec21.tar.gz barebox-3e361f37643bfaea1b1bc06ab9767b2755deec21.tar.xz |
login: check return value of digest_alloc
digest_alloc can fail, check the return value.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/password.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/common/password.c b/common/password.c index 0cb79b8648..43c5e0cc0e 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); } |