diff options
author | ume <ume@FreeBSD.org> | 2006-05-21 11:22:31 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2006-05-21 11:22:31 +0000 |
commit | c49929798600cc98625b30e672dfe77235791a07 (patch) | |
tree | a82b4c284a5ddf2b821903c9504a21a50b34beb7 /lib/libc/net/getnameinfo.c | |
parent | 2103e7a60f93b5663802fad9b458412411640d7c (diff) | |
download | FreeBSD-src-c49929798600cc98625b30e672dfe77235791a07.zip FreeBSD-src-c49929798600cc98625b30e672dfe77235791a07.tar.gz |
Return EAI_OVERFLOW instead of EAI_MEMORY when the supplied buffer is
too short. This conforms to RFC3493, POSIX and XPG6.
Obtained from: NetBSD
Diffstat (limited to 'lib/libc/net/getnameinfo.c')
-rw-r--r-- | lib/libc/net/getnameinfo.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/net/getnameinfo.c b/lib/libc/net/getnameinfo.c index b14cc27..ed1e3af 100644 --- a/lib/libc/net/getnameinfo.c +++ b/lib/libc/net/getnameinfo.c @@ -280,7 +280,7 @@ ip6_parsenumeric(const struct sockaddr *sa, const char *addr, numaddrlen = strlen(numaddr); if (numaddrlen + 1 > hostlen) /* don't forget terminator */ - return EAI_MEMORY; + return EAI_OVERFLOW; strlcpy(host, numaddr, hostlen); if (((const struct sockaddr_in6 *)sa)->sin6_scope_id) { @@ -291,9 +291,9 @@ ip6_parsenumeric(const struct sockaddr *sa, const char *addr, (const struct sockaddr_in6 *)(const void *)sa, zonebuf, sizeof(zonebuf), flags); if (zonelen < 0) - return EAI_MEMORY; + return EAI_OVERFLOW; if (zonelen + 1 + numaddrlen + 1 > hostlen) - return EAI_MEMORY; + return EAI_OVERFLOW; /* construct <numeric-addr><delim><zoneid> */ memcpy(host + numaddrlen + 1, zonebuf, |