Skip to content

Commit 33d7367

Browse files
committed
use more cautious array index access
1 parent b826f3c commit 33d7367

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lightning-rapid-gossip-sync/src/processing.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,10 @@ impl<NG: Deref<Target=NetworkGraph<L>>, L: Deref> RapidGossipSync<NG, L> where L
191191
if feature_detail_marker > 0 {
192192
if feature_detail_marker < 7 {
193193
let feature_index = (feature_detail_marker - 1) as usize;
194-
synthetic_node_announcement.features = default_node_features[feature_index].clone();
194+
synthetic_node_announcement.features = default_node_features
195+
.get(feature_index)
196+
.ok_or(DecodeError::InvalidValue)?
197+
.clone();
195198
} else {
196199
let node_features: NodeFeatures = Readable::read(read_cursor)?;
197200
synthetic_node_announcement.features = node_features;

0 commit comments

Comments
 (0)