mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-04-27 19:52:15 +00:00
multiaddr: Fix generation of arbitrary onion addr. (#1451)
Exclude port 0 which is not a valid port number for onion addresses.
This commit is contained in:
parent
e855cd5915
commit
afb1c877a3
@ -103,12 +103,12 @@ impl Arbitrary for Proto {
|
|||||||
22 => {
|
22 => {
|
||||||
let mut a = [0; 10];
|
let mut a = [0; 10];
|
||||||
g.fill(&mut a);
|
g.fill(&mut a);
|
||||||
Proto(Onion(Cow::Owned(a), g.gen()))
|
Proto(Onion(Cow::Owned(a), g.gen_range(1, std::u16::MAX)))
|
||||||
},
|
},
|
||||||
23 => {
|
23 => {
|
||||||
let mut a = [0; 35];
|
let mut a = [0; 35];
|
||||||
g.fill_bytes(&mut a);
|
g.fill_bytes(&mut a);
|
||||||
Proto(Onion3((a, g.gen()).into()))
|
Proto(Onion3((a, g.gen_range(1, std::u16::MAX)).into()))
|
||||||
},
|
},
|
||||||
_ => panic!("outside range")
|
_ => panic!("outside range")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user