File tree Expand file tree Collapse file tree 3 files changed +4
-9
lines changed
Expand file tree Collapse file tree 3 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -148,9 +148,7 @@ impl ToBytes for CryptoDataPayload {
148148#[ cfg( test) ]
149149mod tests {
150150 use super :: * ;
151- use nom:: { Err ,
152- error:: ErrorKind
153- } ;
151+ use nom:: { Err , error:: ErrorKind } ;
154152
155153 encode_decode_test ! (
156154 crypto_data_encode_decode,
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ impl FromBytes for ShareRelays {
3232 named ! ( from_bytes<ShareRelays >, do_parse!(
3333 tag!( & [ PACKET_ID_SHARE_RELAYS ] [ ..] ) >>
3434 relays: many0!( PackedNode :: from_tcp_bytes) >>
35- verify!( value!( relays. len( ) ) , |len| * len <= 3 ) >>
35+ verify!( value!( relays. len( ) ) , |len| * len <= MAX_SHARED_RELAYS ) >>
3636 ( ShareRelays {
3737 relays,
3838 } )
Original file line number Diff line number Diff line change @@ -42,11 +42,8 @@ impl FromBytes for OnionRequest2 {
4242 tag!( & [ 0x82 ] [ ..] ) >>
4343 nonce: call!( Nonce :: from_bytes) >>
4444 temporary_pk: call!( PublicKey :: from_bytes) >>
45- rest_len: rest_len >>
46- payload: map_opt!( cond!(
47- rest_len >= ONION_RETURN_2_SIZE ,
48- take!( rest_len - ONION_RETURN_2_SIZE )
49- ) , |payload| payload) >>
45+ rest_len: verify!( rest_len, |rest_len| * rest_len >= ONION_RETURN_2_SIZE ) >>
46+ payload: take!( rest_len - ONION_RETURN_2_SIZE ) >>
5047 onion_return: call!( OnionReturn :: from_bytes) >>
5148 ( OnionRequest2 {
5249 nonce,
You can’t perform that action at this time.
0 commit comments