summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-06-29 03:47:41 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-06-29 03:47:41 +0000
commit24471b89b79526a339d0cd0f7db016ed5ce08987 (patch)
tree64031e6d00968ad0c6fb1c9b69c837be124f5678
parent1a6c84d15ddbf6ae253cee85365107b81279b8a7 (diff)
force the dns buffers to be aligned using a union, until the retarded
"misalign strings on the stack" bug in gcc4 is fixed (even when that is fixed this idiom is safer and quite common)
-rw-r--r--usr.sbin/ypserv/mkalias/mkalias.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/ypserv/mkalias/mkalias.c b/usr.sbin/ypserv/mkalias/mkalias.c
index 55c7e784ede..58e8806bf14 100644
--- a/usr.sbin/ypserv/mkalias/mkalias.c
+++ b/usr.sbin/ypserv/mkalias/mkalias.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkalias.c,v 1.23 2009/10/27 23:59:58 deraadt Exp $ */
+/* $OpenBSD: mkalias.c,v 1.24 2010/06/29 03:47:40 deraadt Exp $ */
/*
* Copyright (c) 1997 Mats O Jansson <moj@stacken.kth.se>
@@ -80,7 +80,10 @@ split_address(char *address, size_t len, char *user, char *host)
static int
check_host(char *address, size_t len, char *host, int dflag, int uflag, int Eflag)
{
- u_char answer[PACKETSZ];
+ union {
+ HEADER hdr;
+ u_char buf[PACKETSZ];
+ } answer;
int status;
if ((dflag && memchr(address, '@', len)) ||
@@ -90,13 +93,13 @@ check_host(char *address, size_t len, char *host, int dflag, int uflag, int Efla
if ((_res.options & RES_INIT) == 0)
res_init();
- status = res_search(host, C_IN, T_AAAA, answer, sizeof(answer));
+ status = res_search(host, C_IN, T_AAAA, answer.buf, sizeof(answer.buf));
if (status == -1)
- status = res_search(host, C_IN, T_A, answer, sizeof(answer));
+ status = res_search(host, C_IN, T_A, answer.buf, sizeof(answer.buf));
if (status == -1 && Eflag)
- status = res_search(host, C_IN, T_MX, answer, sizeof(answer));
+ status = res_search(host, C_IN, T_MX, answer.buf, sizeof(answer.buf));
return(status == -1);
}