projects
/
rust-lightning
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9abe4bb
)
Add length check for read ChannelMonitor keys
author
Elias Rohrer
<dev@tnull.de>
Fri, 8 Sep 2023 08:00:25 +0000
(10:00 +0200)
committer
Elias Rohrer
<dev@tnull.de>
Mon, 11 Sep 2023 08:17:03 +0000
(10:17 +0200)
lightning/src/util/persist.rs
patch
|
blob
|
history
diff --git
a/lightning/src/util/persist.rs
b/lightning/src/util/persist.rs
index ca0605c95983afd3b370cafddaf82de2868dadfb..372a094a931bed6dcca159e4bab310cdd7863a4b 100644
(file)
--- a/
lightning/src/util/persist.rs
+++ b/
lightning/src/util/persist.rs
@@
-216,6
+216,12
@@
where
for stored_key in kv_store.list(
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(|_| {
io::Error::new(io::ErrorKind::InvalidData, "Invalid tx ID in stored key")
})?;