diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | inet/getnameinfo.c | 14 |
2 files changed, 23 insertions, 1 deletions
@@ -1,3 +1,13 @@ +2000-03-22 Ulrich Drepper <drepper@redhat.com> + + * inet/getnameinfo.c (getnameinfo): Check that addrlen value is + large enough. Patch by YOSHIFUJI Hideaki <yoshfuji@v6.linux.or.jp>. + +2000-03-22 Andreas Jaeger <aj@suse.de> + + * sysdeps/unix/sysv/linux/powerpc/bits/mman.h (MADV_*): Add flags + from latest Linux kernel. + 2000-03-21 Andreas Jaeger <aj@suse.de> * Versions.def: Add version 2.1.4. diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c index 709f9ecbfe..9a0709229e 100644 --- a/inet/getnameinfo.c +++ b/inet/getnameinfo.c @@ -172,8 +172,20 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, int herrno; char *tmpbuf = alloca (tmpbuflen); struct hostent th; + socklen_t min_addrlen = 0; - if (sa == NULL) + if (sa == NULL || addrlen < sizeof (sa_family_t)) + return -1; + + switch (sa->sa_family) + { + case AF_LOCAL: + min_addrlen = (socklen_t) (((struct sockaddr_un *) NULL)->sun_path); + break; + default: + min_addrlen = __libc_sa_len (sa->sa_family); + } + if (addrlen < min_addrlen) return -1; if (host != NULL && hostlen > 0) |