Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QuicAddrSetToLoopback does not fill remaining bytes with zero #3969

Open
4 tasks
shit-lord opened this issue Nov 25, 2023 · 1 comment
Open
4 tasks

QuicAddrSetToLoopback does not fill remaining bytes with zero #3969

shit-lord opened this issue Nov 25, 2023 · 1 comment
Labels
Area: API external Proposed by non-MSFT
Milestone

Comments

@shit-lord
Copy link

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

@nibanks nibanks added this to the Future milestone Nov 25, 2023
@nibanks
Copy link
Member

nibanks commented Nov 25, 2023

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

@nibanks nibanks added the external Proposed by non-MSFT label Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: API external Proposed by non-MSFT
Projects
None yet
Development

No branches or pull requests

2 participants