Fix potential numeric overflow in tree calculation.

This commit is contained in:
Herbert Wolverson 2023-08-28 21:25:31 +00:00
parent 7004ecc83f
commit 3d1d329dff

View File

@ -21,7 +21,7 @@ impl From<&NetworkJsonNode> for NetworkTreeEntry {
};
let mut sum = 0;
for n in value.rtts.iter() {
let n = *n;
let n = u16::min(*n, 100);
sum += n;
if n < min { min = n; }
if n > max { max = n; }