msquic
msquic copied to clipboard
QuicAddrSetToLoopback does not fill remaining bytes with zero
Describe the bug
void QuicAddrSetToLoopback( Inout QUIC_ADDR* Addr ) { if (Addr->si_family == QUIC_ADDRESS_FAMILY_INET) { Addr->Ipv4.sin_addr.S_un.S_un_b.s_b1 = 127; Addr->Ipv4.sin_addr.S_un.S_un_b.s_b4 = 1; } else { Addr->Ipv6.sin6_addr.u.Byte[15] = 1; } }
For example, in ipv6 case Addr->Ipv6.sin6_addr.u.Byte[0] ... Addr->Ipv6.sin6_addr.u.Byte[14] are unchanged. Is this intended behavior that requires the input to be preinitialized with 0?
Affected OS
- [ ] Windows
- [ ] Linux
- [ ] macOS
- [ ] Other (specify below)
Additional OS information
No response
MsQuic version
main
Steps taken to reproduce bug
QUIC_ADDR loopback; QuicAddrSetFamily(&loopback,QUIC_ADDRESS_FAMILY_INET6); QuicAddrSetToLoopback(&loopback);
Expected behavior
loopback properly set to ::1
Actual outcome
uninitialized garbage
Additional details
No response
Looks like you're right! Feel free to submit a PR to fix too.