From 9adc8ceae483c2bba405a62641ca116f53ff87ef Mon Sep 17 00:00:00 2001
From: deraadt <>
Date: Tue, 29 Jun 2010 09:22:06 +0000
Subject: use a union to align the dns answer buffer until gcc4 is fixed

---
 src/lib/libc/net/getrrsetbyname.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

(limited to 'src/lib')

diff --git a/src/lib/libc/net/getrrsetbyname.c b/src/lib/libc/net/getrrsetbyname.c
index 89aa592ba0..2bbb6ccf83 100644
--- a/src/lib/libc/net/getrrsetbyname.c
+++ b/src/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;
-- 
cgit v1.2.3-55-g6feb