mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-03-26 21:42:35 +01:00
Add length check for read ChannelMonitor keys
This commit is contained in:
parent
9abe4bb23d
commit
aeaed62894
1 changed files with 6 additions and 0 deletions
|
@ -216,6 +216,12 @@ where
|
||||||
for stored_key in kv_store.list(
|
for stored_key in kv_store.list(
|
||||||
CHANNEL_MONITOR_PERSISTENCE_NAMESPACE, CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE)?
|
CHANNEL_MONITOR_PERSISTENCE_NAMESPACE, CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE)?
|
||||||
{
|
{
|
||||||
|
if stored_key.len() < 66 {
|
||||||
|
return Err(io::Error::new(
|
||||||
|
io::ErrorKind::InvalidData,
|
||||||
|
"Stored key has invalid length"));
|
||||||
|
}
|
||||||
|
|
||||||
let txid = Txid::from_hex(stored_key.split_at(64).0).map_err(|_| {
|
let txid = Txid::from_hex(stored_key.split_at(64).0).map_err(|_| {
|
||||||
io::Error::new(io::ErrorKind::InvalidData, "Invalid tx ID in stored key")
|
io::Error::new(io::ErrorKind::InvalidData, "Invalid tx ID in stored key")
|
||||||
})?;
|
})?;
|
||||||
|
|
Loading…
Add table
Reference in a new issue