mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-10 13:18:14 -05:00
[chromecast] Check for null address from getifaddrs() (credit @yantoz, issue #455)
This commit is contained in:
parent
55e4350b18
commit
10233dcad3
@ -454,9 +454,21 @@ stream_url_make(char *out, size_t len, const char *peer_addr, int family)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
found = 0;
|
found = 0;
|
||||||
getifaddrs(&ifap);
|
ret = getifaddrs(&ifap);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
DPRINTF(E_LOG, L_CAST, "Could not get interface address: %s\n", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
for (ifa = ifap; !found && ifa; ifa = ifa->ifa_next)
|
for (ifa = ifap; !found && ifa; ifa = ifa->ifa_next)
|
||||||
{
|
{
|
||||||
|
if (!ifa->ifa_addr)
|
||||||
|
{
|
||||||
|
DPRINTF(E_LOG, L_CAST, "Skipping null address from getifaddrs()\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (ifa->ifa_addr->sa_family != family)
|
if (ifa->ifa_addr->sa_family != family)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user