We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 28c9b56 commit 7dbfd8eCopy full SHA for 7dbfd8e
lightning/src/onion_message/packet.rs
@@ -69,7 +69,7 @@ impl LengthReadable for Packet {
69
let public_key = Readable::read(r)?;
70
71
let mut hop_data = Vec::new();
72
- let hop_data_len = r.total_bytes() as usize - 66; // 1 (version) + 33 (pubkey) + 32 (HMAC) = 66
+ let hop_data_len = r.total_bytes().saturating_sub(66) as usize; // 1 (version) + 33 (pubkey) + 32 (HMAC) = 66
73
let mut read_idx = 0;
74
while read_idx < hop_data_len {
75
let mut read_buffer = [0; READ_BUFFER_SIZE];
0 commit comments