Add length check
This commit is contained in:
parent
6cab39e41d
commit
84b671d585
1 changed files with 3 additions and 0 deletions
|
@ -288,6 +288,9 @@ fn verify_password(password: &str, salted_hash: &str) -> bool {
|
||||||
return password == salted_hash;
|
return password == salted_hash;
|
||||||
}
|
}
|
||||||
let bytes = bytes.unwrap();
|
let bytes = bytes.unwrap();
|
||||||
|
if bytes.len() < 17 {
|
||||||
|
return password == salted_hash;
|
||||||
|
}
|
||||||
let (salt, hashed_password) = bytes.split_at(16);
|
let (salt, hashed_password) = bytes.split_at(16);
|
||||||
let hashed_password = &hashed_password[0..32];
|
let hashed_password = &hashed_password[0..32];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue