msquic icon indicating copy to clipboard operation
msquic copied to clipboard

QuicAddrSetToLoopback does not fill remaining bytes with zero

Open shit-lord opened this issue 2 years ago • 1 comments

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

shit-lord avatar Nov 25 '23 14:11 shit-lord

Looks like you're right! Feel free to submit a PR to fix too.

nibanks avatar Nov 25 '23 16:11 nibanks