summaryrefslogtreecommitdiff
path: root/inet
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-12-22 19:21:36 -0500
committerUlrich Drepper <drepper@gmail.com>2011-12-22 19:21:36 -0500
commit27deeafc3fcb12e2873f05be5c41ccfc6f7b08e8 (patch)
treef563a17e2ddd22e6b51644b99f12ed958bba758d /inet
parente7f9dac36202cf09e1b4f5f89c56cc12a29ce9f6 (diff)
downloadglibc-27deeafc3fcb12e2873f05be5c41ccfc6f7b08e8.tar.gz
Fix error code for too small input buffer to getnameinfo
Diffstat (limited to 'inet')
-rw-r--r--inet/getnameinfo.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 6fb6ad6e1d..436604b756 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -346,10 +346,11 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
"%u", scopeid);
if (real_hostlen + scopelen + 1 > hostlen)
- /* XXX We should not fail here. Simply enlarge
- the buffer or return with out of memory. */
- return EAI_SYSTEM;
- memcpy (host + real_hostlen, scopebuf, scopelen + 1);
+ /* Signal the buffer is too small. This is
+ what inet_ntop does. */
+ c = NULL;
+ else
+ memcpy (host + real_hostlen, scopebuf, scopelen + 1);
}
}
else
@@ -357,7 +358,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
(const void *) &(((const struct sockaddr_in *) sa)->sin_addr),
host, hostlen);
if (c == NULL)
- return EAI_SYSTEM;
+ return EAI_OVERFLOW;
}
ok = 1;
}