diff options
Diffstat (limited to 'src/lib/libc')
| -rw-r--r-- | src/lib/libc/net/res_query.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/libc/net/res_query.c b/src/lib/libc/net/res_query.c index c8a45a5df5..1485abb2d7 100644 --- a/src/lib/libc/net/res_query.c +++ b/src/lib/libc/net/res_query.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: res_query.c,v 1.25 2007/05/16 04:14:23 ray Exp $ */ | 1 | /* $OpenBSD: res_query.c,v 1.26 2010/06/29 21:08:54 deraadt Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * ++Copyright++ 1988, 1993 | 4 | * ++Copyright++ 1988, 1993 |
| @@ -96,7 +96,10 @@ res_query(const char *name, | |||
| 96 | int anslen) /* size of answer buffer */ | 96 | int anslen) /* size of answer buffer */ |
| 97 | { | 97 | { |
| 98 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); | 98 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); |
| 99 | u_char buf[MAXPACKET]; | 99 | union { |
| 100 | HEADER hdr; | ||
| 101 | u_char buf[MAXPACKET]; | ||
| 102 | } buf; | ||
| 100 | HEADER *hp = (HEADER *) answer; | 103 | HEADER *hp = (HEADER *) answer; |
| 101 | int n; | 104 | int n; |
| 102 | 105 | ||
| @@ -112,10 +115,10 @@ res_query(const char *name, | |||
| 112 | #endif | 115 | #endif |
| 113 | 116 | ||
| 114 | n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL, | 117 | n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL, |
| 115 | buf, sizeof(buf)); | 118 | buf.buf, sizeof(buf.buf)); |
| 116 | if (n > 0 && ((_resp->options & RES_USE_EDNS0) || | 119 | if (n > 0 && ((_resp->options & RES_USE_EDNS0) || |
| 117 | (_resp->options & RES_USE_DNSSEC))) { | 120 | (_resp->options & RES_USE_DNSSEC))) { |
| 118 | n = res_opt(n, buf, sizeof(buf), anslen); | 121 | n = res_opt(n, buf.buf, sizeof(buf.buf), anslen); |
| 119 | } | 122 | } |
| 120 | 123 | ||
| 121 | if (n <= 0) { | 124 | if (n <= 0) { |
| @@ -126,7 +129,7 @@ res_query(const char *name, | |||
| 126 | h_errno = NO_RECOVERY; | 129 | h_errno = NO_RECOVERY; |
| 127 | return (n); | 130 | return (n); |
| 128 | } | 131 | } |
| 129 | n = res_send(buf, n, answer, anslen); | 132 | n = res_send(buf.buf, n, answer, anslen); |
| 130 | if (n < 0) { | 133 | if (n < 0) { |
| 131 | #ifdef DEBUG | 134 | #ifdef DEBUG |
| 132 | if (_resp->options & RES_DEBUG) | 135 | if (_resp->options & RES_DEBUG) |
