Skip to content

Conversation

@devnexen
Copy link
Member

The actual buffer size is too small for ipv6, should be INET6_ADDRSTRLEN (46) also the size of the buffer should be set accordingly to the family.

The actual buffer size is too small for ipv6, should be INET6_ADDRSTRLEN
(46) also the size of the buffer should be set accordingly to the
family.
@devnexen
Copy link
Member Author

note that I set on master purposely as it is not really a bug fix per say. let me know if you disagree.

int af = AF_INET;
char buffer[40];
socklen_t buffersize = INET_ADDRSTRLEN;
char buffer[INET6_ADDRSTRLEN];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is anything INET6_* defined when HAVE_IPV6 is not?

Also, is it safe to use shorter buffersize when compiled /wo IPv6 support and then run on system /w IPv6 support?

Copy link
Member Author

Choose a reason for hiding this comment

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

Is anything INET6_* defined when HAVE_IPV6 is not?

Yes it is independant from ipv6 support and, alone, does not indicate the system supports it.

Also, is it safe to use shorter buffersize when compiled /wo IPv6 support and then run on system /w IPv6 support?

Yes in that case the best course is to reverse the logic.

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