8000 make sure p->ifa_addr is not NULL before using it by jscipione · Pull Request #3322 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

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

Closed
jscipione wants to merge 1 commit intofish-shell:masterfrom
jscipione:patch-1
Closed

make sure p->ifa_addr is not NULL before using it#3322
jscipione wants to merge 1 commit intofish-shell:masterfrom
jscipione:patch-1

Conversation

@jscipione
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
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.

@jscipione
Copy link
Contributor Author

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 Something that's not working as intended label Aug 23, 2016
@krader1961
Copy link
Contributor

Merged as a872d9c.

@floam floam added this to the next-2.x milestone Aug 24, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something that's not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0