| author | bors <bors@rust-lang.org> 2026-06-28 08:01:34 UTC |
| committer | bors <bors@rust-lang.org> 2026-06-28 08:01:34 UTC |
| log | 11823209557bba4f6acb520109c63aa78c041683 |
| tree | 669241797c897c36e1969dc0e4553bc1a1ed9ff7 |
| parent | fd07dbfc91b7b6b3fa76d957e130c51e654131ee |
| parent | 53cc2f81d4533150ad42b75533362ca599c36303 |
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.1 files changed, 2 insertions(+), 3 deletions(-)
library/std/src/sys/net/connection/xous/dns.rs+2-3| ... | ... | @@ -43,9 +43,8 @@ impl Iterator for LookupHost { |
| 43 | 43 | return None; |
| 44 | 44 | } |
| 45 | 45 | 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()) | |
| 49 | 48 | { |
| 50 | 49 | *octet = *src; |
| 51 | 50 | } |