summaryrefslogtreecommitdiffstats
path: root/lib/libc/asr/gethostnamadr_async.c
diff options
context:
space:
mode:
authorbrynet <brynet@openbsd.org>2015-03-02 14:22:48 +0000
committerbrynet <brynet@openbsd.org>2015-03-02 14:22:48 +0000
commit5712b4f12da314491d5cbdad34d29037569cc63b (patch)
treef026664b38aec2c89a4cedce14357156a85a7970 /lib/libc/asr/gethostnamadr_async.c
parentCorrectly set lowest_present_ofdm in iwm_mvm_ack_rates(). (diff)
downloadwireguard-openbsd-5712b4f12da314491d5cbdad34d29037569cc63b.tar.xz
wireguard-openbsd-5712b4f12da314491d5cbdad34d29037569cc63b.zip
gethostbyname(3) would fail when more than 16 addrs/aliases were returned.
Bump MAXADDRS/ALIASES to the original of 35, and silently ignore extras instead of failing. Noticed by markson on freenode. OK eric@ "with revised diff", phessler@.
Diffstat (limited to 'lib/libc/asr/gethostnamadr_async.c')
-rw-r--r--lib/libc/asr/gethostnamadr_async.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libc/asr/gethostnamadr_async.c b/lib/libc/asr/gethostnamadr_async.c
index 83acf61120f..7f39e777343 100644
--- a/lib/libc/asr/gethostnamadr_async.c
+++ b/lib/libc/asr/gethostnamadr_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gethostnamadr_async.c,v 1.34 2015/01/16 16:48:51 deraadt Exp $ */
+/* $OpenBSD: gethostnamadr_async.c,v 1.35 2015/03/02 14:22:48 brynet Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -41,8 +41,8 @@
#include "asr_private.h"
-#define MAXALIASES 16
-#define MAXADDRS 16
+#define MAXALIASES 35
+#define MAXADDRS 35
struct hostent_ext {
struct hostent h;
@@ -609,7 +609,7 @@ hostent_add_alias(struct hostent_ext *h, const char *name, int isdname)
if (h->aliases[i] == NULL)
break;
if (i == MAXALIASES)
- return (-1);
+ return (0);
if (isdname) {
asr_strdname(name, buf, sizeof buf);
@@ -621,7 +621,7 @@ hostent_add_alias(struct hostent_ext *h, const char *name, int isdname)
n = strlen(name) + 1;
if (h->pos + n >= h->end)
- return (-1);
+ return (0);
h->aliases[i] = h->pos;
memmove(h->pos, name, n);
@@ -638,10 +638,10 @@ hostent_add_addr(struct hostent_ext *h, const void *addr, size_t size)
if (h->addrs[i] == NULL)
break;
if (i == MAXADDRS)
- return (-1);
+ return (0);
if (h->pos + size >= h->end)
- return (-1);
+ return (0);
h->addrs[i] = h->pos;
memmove(h->pos, addr, size);