This commit is contained in:
2025-04-20 06:52:35 +02:00
parent 7dff7ecc5e
commit eccea1ad04
4 changed files with 31 additions and 12 deletions

View File

@@ -27,10 +27,10 @@ impl Location {
// Create padded bytes
let mut padded = vec![0u8; keysize as usize];
let start_idx = keysize as usize - bytes.len();
if start_idx < 0 {
if bytes.len() > keysize as usize {
return Err(Error::InvalidOperation("Input bytes exceed keysize".to_string()));
}
let start_idx = keysize as usize - bytes.len();
for (i, &b) in bytes.iter().enumerate() {
if i + start_idx < padded.len() {