aboutsummaryrefslogtreecommitdiff
path: root/inet/getnameinfo.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-03-22 18:14:48 +0000
committerUlrich Drepper <drepper@redhat.com>2000-03-22 18:14:48 +0000
commit922809a2e3dbb92b6faae17523d055783295cbdc (patch)
tree92c4afbb315d765768414d30734aaf6285bf4c42 /inet/getnameinfo.c
parentee0835df62285caaa5b3ff8aed5ec15358fd123d (diff)
downloadglibc-922809a2e3dbb92b6faae17523d055783295cbdc.zip
glibc-922809a2e3dbb92b6faae17523d055783295cbdc.tar.gz
glibc-922809a2e3dbb92b6faae17523d055783295cbdc.tar.bz2
Update.
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.
Diffstat (limited to 'inet/getnameinfo.c')
-rw-r--r--inet/getnameinfo.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 709f9ec..9a07092 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)