summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2010-06-29 09:22:06 +0000
committerderaadt <deraadt@openbsd.org>2010-06-29 09:22:06 +0000
commit016e67d611fbdf98c61d1f93ead1eeaa9089ee91 (patch)
tree37e4079ab54af930401d9b49bc3b87f0132090ca /lib/libc
parentInterface drivers should use DV_IFNET, not DV_DULL. (diff)
downloadwireguard-openbsd-016e67d611fbdf98c61d1f93ead1eeaa9089ee91.tar.xz
wireguard-openbsd-016e67d611fbdf98c61d1f93ead1eeaa9089ee91.zip
use a union to align the dns answer buffer until gcc4 is fixed
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/getrrsetbyname.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/libc/net/getrrsetbyname.c b/lib/libc/net/getrrsetbyname.c
index 89aa592ba04..2bbb6ccf83e 100644
--- a/lib/libc/net/getrrsetbyname.c
+++ b/lib/libc/net/getrrsetbyname.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getrrsetbyname.c,v 1.11 2007/10/11 18:36:41 jakob Exp $ */
+/* $OpenBSD: getrrsetbyname.c,v 1.12 2010/06/29 09:22:06 deraadt Exp $ */
/*
* Copyright (c) 2001 Jakob Schlyter. All rights reserved.
@@ -53,7 +53,7 @@
#include "thread_private.h"
-#define ANSWER_BUFFER_SIZE 1024*64
+#define MAXPACKET 1024*64
struct dns_query {
char *name;
@@ -105,7 +105,10 @@ getrrsetbyname(const char *hostname, unsigned int rdclass,
struct rdatainfo *rdata;
int length;
unsigned int index_ans, index_sig;
- u_char answer[ANSWER_BUFFER_SIZE];
+ union {
+ HEADER hdr;
+ u_char buf[MAXPACKET];
+ } answer;
/* check for invalid class and type */
if (rdclass > 0xffff || rdtype > 0xffff) {
@@ -143,7 +146,7 @@ getrrsetbyname(const char *hostname, unsigned int rdclass,
/* make query */
length = res_query(hostname, (signed int) rdclass, (signed int) rdtype,
- answer, sizeof(answer));
+ answer.buf, sizeof(answer.buf));
if (length < 0) {
switch(h_errno) {
case HOST_NOT_FOUND:
@@ -159,7 +162,7 @@ getrrsetbyname(const char *hostname, unsigned int rdclass,
}
/* parse result */
- response = parse_dns_response(answer, length);
+ response = parse_dns_response(answer.buf, length);
if (response == NULL) {
result = ERRSET_FAIL;
goto fail;