Skip to content

Conversation

EllainYang
Copy link
Contributor

I get SIGSEGV when try to execute it (ubuntu 16.04, gcc 5.4.0). According to http://man7.org/linux/man-pages/man3/getifaddrs.3.html :

The ifa_addr field points to a structure containing the interface
address. (The sa_family subfield should be consulted to determine
the format of the address structure.) This field may contain a null
pointer
.

Little check for null pointer proposed. Or may be it'll be better with for cycle since two lines of adress = adress->ifa_addr in my proposal.

I get sigseg when try to execute it (ubuntu 16.04, gcc 5.4.0). According to http://man7.org/linux/man-pages/man3/getifaddrs.3.html : "The ifa_addr... .This field may contain a null pointer."
Little check for null pointer proposed. Or may be it'll be better with for cycle since two lines of adress = adress->ifa_addr in my proposal.
@codeplea codeplea merged commit 8289379 into codeplea:master Dec 2, 2019
@codeplea
Copy link
Owner

codeplea commented Dec 2, 2019

Thank you for this. Thanks for linking to the documentation too. It's very helpful when reviewing PRs.

@EllainYang EllainYang deleted the patch-1 branch December 6, 2019 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants