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

make sure p->ifa_addr is not NULL before using it #3322

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@jscipione
Contributor

jscipione commented Aug 22, 2016

Description

p->ifa_addr might be a NULL pointer and thus crash the program

From
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.
_

@jscipione

This comment has been minimized.

Show comment
Hide comment
@jscipione

jscipione Aug 22, 2016

Contributor

This is needed for Haiku which you guys probably don't care much about, but, is a potential problem on all platforms and doesn't cost much.

Contributor

jscipione commented Aug 22, 2016

This is needed for Haiku which you guys probably don't care much about, but, is a potential problem on all platforms and doesn't cost much.

@krader1961 krader1961 self-assigned this Aug 23, 2016

@krader1961

This comment has been minimized.

Show comment
Hide comment
@krader1961

krader1961 Aug 23, 2016

Contributor

I'll merge this since it is obviously correct. However, I'm wondering what ifa_name contains for the interface for which ifa_addr is NULL on your system and the purpose of that interface. Which is to say I'm wondering if there are related incorrect assumptions in the fish code that this particular issue might expose if we better understood the nature of the failure.

Contributor

krader1961 commented Aug 23, 2016

I'll merge this since it is obviously correct. However, I'm wondering what ifa_name contains for the interface for which ifa_addr is NULL on your system and the purpose of that interface. Which is to say I'm wondering if there are related incorrect assumptions in the fish code that this particular issue might expose if we better understood the nature of the failure.

@jscipione

This comment has been minimized.

Show comment
Hide comment
@jscipione

jscipione Aug 23, 2016

Contributor

There are 2 cases where ifa_addr can be NULL on Haiku, one is if an interface's address.sa_family == AF_UNSPEC and the other is if there was an error copying the interface's address (i.e. new throws an exception). The latter is probably not happening so I'm guessing the case we're running into is the former, one or more of the interfaces has an unspecified address family. I'm not sure whether or not there is a bug on our side here, but it is possible.

Contributor

jscipione commented Aug 23, 2016

There are 2 cases where ifa_addr can be NULL on Haiku, one is if an interface's address.sa_family == AF_UNSPEC and the other is if there was an error copying the interface's address (i.e. new throws an exception). The latter is probably not happening so I'm guessing the case we're running into is the former, one or more of the interfaces has an unspecified address family. I'm not sure whether or not there is a bug on our side here, but it is possible.

@floam floam added the bug label Aug 23, 2016

@krader1961

This comment has been minimized.

Show comment
Hide comment
@krader1961

krader1961 Aug 24, 2016

Contributor

Merged as a872d9c.

Contributor

krader1961 commented Aug 24, 2016

Merged as a872d9c.

@krader1961 krader1961 closed this Aug 24, 2016

@floam floam added this to the next-2.x milestone Aug 24, 2016

@krader1961 krader1961 modified the milestones: fish 2.3.2, next-2.x Sep 3, 2016

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