Skip to content

Commit b2241e6

Browse files
committed
Auto merge of #158457 - devnexen:xous_ipv6_fix, r=joboet
std: fix xous dns ipv6 parsing off-by-one the ipv6 arm read the 16-byte address from offset+1 instead of offset, unlike the ipv4 arm. this mis-parsed every ipv6 result and let the slice reach offset+17 while the bounds check only guards offset+16, so a malformed dns response could index past the 4096-byte buffer and panic.
2 parents fd07dbf + 53cc2f8 commit b2241e6

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

  • library/std/src/sys/net/connection/xous

library/std/src/sys/net/connection/xous/dns.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ impl Iterator for LookupHost {
4343
return None;
4444
}
4545
let mut new_addr = [0u8; 16];
46-
for (src, octet) in self.data.0[(self.offset + 1)..(self.offset + 16 + 1)]
47-
.iter()
48-
.zip(new_addr.iter_mut())
46+
for (src, octet) in
47+
self.data.0[self.offset..(self.offset + 16)].iter().zip(new_addr.iter_mut())
4948
{
5049
*octet = *src;
5150
}

0 commit comments

Comments
 (0)