mirror of git://sourceware.org/git/glibc.git
nss: Fix UB on test-netdb
The gethostname is defined as not accepting NULL arguments, so use a minimal size for initial call.
This commit is contained in:
parent
dc4b8962cb
commit
6a180670f8
|
|
@ -178,6 +178,9 @@ test_hosts (void)
|
||||||
hptr1 = gethostbyname2 ("localhost", AF_INET);
|
hptr1 = gethostbyname2 ("localhost", AF_INET);
|
||||||
output_hostent ("gethostbyname2 (\"localhost\", AF_INET)", hptr1);
|
output_hostent ("gethostbyname2 (\"localhost\", AF_INET)", hptr1);
|
||||||
|
|
||||||
|
name = xmalloc (2);
|
||||||
|
namelen += 2;
|
||||||
|
|
||||||
while (gethostname (name, namelen) < 0 && errno == ENAMETOOLONG)
|
while (gethostname (name, namelen) < 0 && errno == ENAMETOOLONG)
|
||||||
{
|
{
|
||||||
namelen += 2; /* tiny increments to test a lot */
|
namelen += 2; /* tiny increments to test a lot */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue