Fix IPV6 address deserialization (#1932)

Fuzz test found that we don't read IPV6 addr (as part of p2p message)
properly. The code is supposed to read 8 dwords, but [0..8] is not a
slice of 8 ints, but a slice of one Range, so we always read just one
dword
This commit is contained in:
hashmap
2018-11-06 05:38:41 +01:00
committed by Ignotus Peverell
parent 109a426990
commit 0af1f13bf9
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -29,7 +29,15 @@ macro_rules! map_vec {
#[macro_export]
macro_rules! try_map_vec {
($thing:expr, $mapfn:expr) => {
$thing.iter().map($mapfn).collect::<Result<Vec<_>, _>>()?;
try_iter_map_vec!($thing.iter(), $mapfn);
};
}
/// Same as try_map_vec when thing is an iterator
#[macro_export]
macro_rules! try_iter_map_vec {
($thing:expr, $mapfn:expr) => {
$thing.map($mapfn).collect::<Result<Vec<_>, _>>()?;
};
}