diff options
author | Ulrich Drepper <drepper@redhat.com> | 2008-12-09 10:02:20 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2008-12-09 10:02:20 +0000 |
commit | d4f0720b201778bedd41b662643d28701b079717 (patch) | |
tree | eb9881545720dcf4a864bd19cda714f34a9a7f23 /inet/getnameinfo.c | |
parent | cd72adebda1a008550de05cfcc669b90c36bc438 (diff) | |
download | glibc-d4f0720b201778bedd41b662643d28701b079717.zip glibc-d4f0720b201778bedd41b662643d28701b079717.tar.gz glibc-d4f0720b201778bedd41b662643d28701b079717.tar.bz2 |
[BZ #7080]
2008-12-08 Ulrich Drepper <drepper@redhat.com>
[BZ #7080]
* inet/getnameinfo.c (getnameinfo): Check for output buffers being
NULL when NI_NAMEREQD is set.
Patch mostly by Yang Hongyang <yanghy@cn.fujitsu.com>.
* inet/Makefile (tests): Add tst-getni1.
* inet/tst-getni1.c: New file.
Diffstat (limited to 'inet/getnameinfo.c')
-rw-r--r-- | inet/getnameinfo.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c index 50240383..db6b5c7 100644 --- a/inet/getnameinfo.c +++ b/inet/getnameinfo.c @@ -178,6 +178,9 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, if (sa == NULL || addrlen < sizeof (sa_family_t)) return EAI_FAMILY; + if ((flags & NI_NAMEREQD) && host == NULL && serv == NULL) + return EAI_NONAME; + switch (sa->sa_family) { case AF_LOCAL: |