fix: crypt_sha: bounds-check before slicing setting

This commit is contained in:
lyw458372
2026-06-08 21:07:53 +08:00
parent 4a521f06e1
commit 5a3322ba97
+1 -1
View File
@@ -77,7 +77,7 @@ pub fn crypt_sha(passw: &str, setting: &str, cipher: ShaType) -> Option<String>
let has_round;
// 7 is len("rounds=")
if &setting[cursor..cursor + 7] == RSTRING {
if setting.get(cursor..cursor + 7) == Some(RSTRING) {
cursor += 7;
has_round = true;
if let Some(c_end) = setting[cursor..].chars().position(|r| r == '$') {