diff options
author | deraadt <> | 2010-06-29 09:22:06 +0000 |
---|---|---|
committer | deraadt <> | 2010-06-29 09:22:06 +0000 |
commit | 9adc8ceae483c2bba405a62641ca116f53ff87ef (patch) | |
tree | f0f9f09b0dbdf17b357a613f66b716b7b3a86d19 | |
parent | bc843bdaea2c5cdfa13abd41ea3ea01f533ee149 (diff) | |
download | openbsd-9adc8ceae483c2bba405a62641ca116f53ff87ef.tar.gz openbsd-9adc8ceae483c2bba405a62641ca116f53ff87ef.tar.bz2 openbsd-9adc8ceae483c2bba405a62641ca116f53ff87ef.zip |
use a union to align the dns answer buffer until gcc4 is fixed
-rw-r--r-- | src/lib/libc/net/getrrsetbyname.c | 13 |
1 files changed, 8 insertions, 5 deletions
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 @@ | |||
1 | /* $OpenBSD: getrrsetbyname.c,v 1.11 2007/10/11 18:36:41 jakob Exp $ */ | 1 | /* $OpenBSD: getrrsetbyname.c,v 1.12 2010/06/29 09:22:06 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001 Jakob Schlyter. All rights reserved. | 4 | * Copyright (c) 2001 Jakob Schlyter. All rights reserved. |
@@ -53,7 +53,7 @@ | |||
53 | 53 | ||
54 | #include "thread_private.h" | 54 | #include "thread_private.h" |
55 | 55 | ||
56 | #define ANSWER_BUFFER_SIZE 1024*64 | 56 | #define MAXPACKET 1024*64 |
57 | 57 | ||
58 | struct dns_query { | 58 | struct dns_query { |
59 | char *name; | 59 | char *name; |
@@ -105,7 +105,10 @@ getrrsetbyname(const char *hostname, unsigned int rdclass, | |||
105 | struct rdatainfo *rdata; | 105 | struct rdatainfo *rdata; |
106 | int length; | 106 | int length; |
107 | unsigned int index_ans, index_sig; | 107 | unsigned int index_ans, index_sig; |
108 | u_char answer[ANSWER_BUFFER_SIZE]; | 108 | union { |
109 | HEADER hdr; | ||
110 | u_char buf[MAXPACKET]; | ||
111 | } answer; | ||
109 | 112 | ||
110 | /* check for invalid class and type */ | 113 | /* check for invalid class and type */ |
111 | if (rdclass > 0xffff || rdtype > 0xffff) { | 114 | if (rdclass > 0xffff || rdtype > 0xffff) { |
@@ -143,7 +146,7 @@ getrrsetbyname(const char *hostname, unsigned int rdclass, | |||
143 | 146 | ||
144 | /* make query */ | 147 | /* make query */ |
145 | length = res_query(hostname, (signed int) rdclass, (signed int) rdtype, | 148 | length = res_query(hostname, (signed int) rdclass, (signed int) rdtype, |
146 | answer, sizeof(answer)); | 149 | answer.buf, sizeof(answer.buf)); |
147 | if (length < 0) { | 150 | if (length < 0) { |
148 | switch(h_errno) { | 151 | switch(h_errno) { |
149 | case HOST_NOT_FOUND: | 152 | case HOST_NOT_FOUND: |
@@ -159,7 +162,7 @@ getrrsetbyname(const char *hostname, unsigned int rdclass, | |||
159 | } | 162 | } |
160 | 163 | ||
161 | /* parse result */ | 164 | /* parse result */ |
162 | response = parse_dns_response(answer, length); | 165 | response = parse_dns_response(answer.buf, length); |
163 | if (response == NULL) { | 166 | if (response == NULL) { |
164 | result = ERRSET_FAIL; | 167 | result = ERRSET_FAIL; |
165 | goto fail; | 168 | goto fail; |