summaryrefslogtreecommitdiff
path: root/inet
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-03-26 18:48:26 +0000
committerUlrich Drepper <drepper@redhat.com>2000-03-26 18:48:26 +0000
commit4fcddf8e57fa96dcf8759d95b5e427bd0cff69b5 (patch)
treed005a27000ed5f9b00c2830541f21690a7887eaa /inet
parent0efadcd9ac89b3a914926b2078d6840176b119d7 (diff)
downloadglibc-4fcddf8e57fa96dcf8759d95b5e427bd0cff69b5.tar.gz
Update.
2000-03-24 Andreas Jaeger <aj@suse.de> * Makefile (postclean): Added soversions.i. 2000-03-24 Scott Bambrough <scottb@netwinder.org> * sysdeps/arm/fpu/fpu_control.h: Define _FPU_MASK_IM, _FPU_MASK_ZM, _FPU_MASK_OM, _FPU_MASK_UM, _FPU_MASK_PM, _FPU_MASK_DM, _FPU_DEFAULT, and _FPU_IEEE. Change _FPU_RESERVED. 2000-03-24 Scott Bambrough <scottb@netwinder.org> * sysdeps/unix/sysv/linux/arm/sys/ucontext.h: New file. 2000-03-24 Roland McGrath <roland@baalperazim.frob.com> * sysdeps/posix/getaddrinfo.c: Include <net/if.h> for if_nametoindex. (gaih_inet): Remove unused duplicate variable. * inet/getnameinfo.c (getnameinfo): Use IFNAMSIZ, not MAXHOSTNAMELEN. Don't use __libc_sa_len, which only exists for Linux. Just handle AF_INET and AF_INET6 directly as well as AF_LOCAL, since those are the only flavors supported by this function anyway. 2000-03-24 Geoff Clare <gwc@unisoft.com> * stdlib/strfmon.c: corrected problems with missing signs and missing or extra spaces; allow for sign strings longer than one character; add padding to ensure positive and negative formats are aligned when a left precision is used. 2000-03-26 Ulrich Drepper <drepper@redhat.com> * stdlib/random_r.c (__setstate_r): Allow RNGs of type 4. Patch by John Mizel <John.Mizel@msdw.com>.
Diffstat (limited to 'inet')
-rw-r--r--inet/getnameinfo.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 6ee3d4d2cc..9f5d761f1a 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -173,7 +173,6 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
int herrno;
char *tmpbuf = alloca (tmpbuflen);
struct hostent th;
- socklen_t min_addrlen = 0;
int ok = 0;
if (sa == NULL || addrlen < sizeof (sa_family_t))
@@ -182,16 +181,23 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
switch (sa->sa_family)
{
case AF_LOCAL:
- min_addrlen = (socklen_t) (((struct sockaddr_un *) NULL)->sun_path);
+ if (addrlen < (socklen_t) (((struct sockaddr_un *) NULL)->sun_path))
+ return -1;
+ break;
+ case AF_INET:
+ if (addrlen < sizeof (struct sockaddr_in))
+ return -1;
+ break;
+ case AF_INET6:
+ if (addrlen < sizeof (struct sockaddr_in6))
+ return -1;
break;
default:
- min_addrlen = __libc_sa_len (sa->sa_family);
+ return -1;
}
- if (addrlen < min_addrlen)
- return -1;
if (host != NULL && hostlen > 0)
- switch(sa->sa_family)
+ switch (sa->sa_family)
{
case AF_INET:
case AF_INET6:
@@ -293,7 +299,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
&& (scopeid = sin6p->sin6_scope_id))
{
/* Buffer is >= IFNAMSIZ+1. */
- char scopebuf[MAXHOSTNAMELEN + 1];
+ char scopebuf[IFNAMSIZ + 1];
int ni_numericscope = 0;
if (IN6_IS_ADDR_LINKLOCAL (&sin6p->sin6_addr)
@@ -365,7 +371,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
}
if (serv && (servlen > 0))
- switch(sa->sa_family)
+ switch (sa->sa_family)
{
case AF_INET:
case AF_INET6: