getaddrinfo: Return EAI_NODATA if gethostbyname2_r reports NO_DATA [BZ #21922]

(cherry picked from commit 5f8340f583)
This commit is contained in:
Florian Weimer 2017-09-04 11:25:34 +02:00
parent e552550b40
commit e3ae300f3f
3 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2017-09-01 Florian Weimer <fweimer@redhat.com>
[BZ #21922]
* sysdeps/posix/getaddrinfo.c (gaih_inet): Report EAI_NODATA error
coming from gethostbyname2_r.
2017-09-01 Florian Weimer <fweimer@redhat.com>
* sysdeps/posix/getaddrinfo.c (gaih_inet): Only use h_errno if

1
NEWS
View File

@ -57,6 +57,7 @@ The following bugs are resolved with this release:
[21624] Unsafe alloca allows local attackers to alias stack and heap (CVE-2017-1000366)
[21654] nss: Fix invalid cast in group merging
[21778] Robust mutex may deadlock
[21922] getaddrinfo with AF_INET(6) returns EAI_NONAME, not EAI_NODATA
[21972] assert macro requires operator== (int) for its argument type
[22322] libc: [mips64] wrong bits/long-double.h installed
[22627] $ORIGIN in $LD_LIBRARY_PATH is substituted twice

View File

@ -613,6 +613,14 @@ gaih_inet (const char *name, const struct gaih_service *service,
}
*pat = addrmem;
}
else
{
if (h_errno == NO_DATA)
result = -EAI_NODATA;
else
result = -EAI_NONAME;
goto free_and_return;
}
}
else
{