fix panic on invalid key sizes

transfer
Avril 4 years ago
parent bf5d2d6d6b
commit 120581995e
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -132,7 +132,7 @@ impl str::FromStr for Key
let mut this = Self::default();
let sz = std::cmp::min(KEY_SIZE, buffer.len());
this.0.copy_from_slice(&buffer[..sz]);
(&mut this.0[..sz]).copy_from_slice(&buffer[..sz]);
Ok(this)
}
}
@ -147,7 +147,7 @@ impl str::FromStr for IV
let mut this = Self::default();
let sz = std::cmp::min(IV_SIZE, buffer.len());
this.0.copy_from_slice(&buffer[..sz]);
(&mut this.0[..sz]).copy_from_slice(&buffer[..sz]);
Ok(this)
}
}

Loading…
Cancel
Save