Merge branch 'fix-crypt_md5' into 'master'
fix: crypt_md5: clamp salt slice to string length See merge request redox-os/relibc!1445
This commit is contained in:
@@ -135,8 +135,9 @@ pub fn crypt_md5(passw: &[u8], setting: &str) -> Option<String> {
|
||||
}
|
||||
|
||||
let cursor = 3;
|
||||
let end = setting.len().min(cursor + SALT_MAX);
|
||||
let slen = cursor
|
||||
+ setting[cursor..cursor + SALT_MAX]
|
||||
+ setting[cursor..end]
|
||||
.chars()
|
||||
.take_while(|c| *c != '$')
|
||||
.count();
|
||||
|
||||
Reference in New Issue
Block a user