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

options/posix: Add support for IPv6 addresses in inet_pton #1202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dennisbonke
Copy link
Member

@48cf can you add the tests you had for this to this (or a separate) PR please?

Part of the systemd on Linux project.

auto addr6 = reinterpret_cast<struct in6_addr*>(dst);

for(int i = 0; i < 8; i++) {
addr6->s6_addr16[i] = addr[i];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not just work directly into this array?

int array_len = 0;

src = abbrev + 2;
while(*src) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this case basically copy pasted from the above one? Can they not be merged?

}

if(abbrev) {
uint16_t array[8] = {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems broken, the array this block writes into goes out of scope before we can write it into the user provided argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants