summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authornaddy <naddy@FreeBSD.org>2002-06-24 12:40:11 +0000
committernaddy <naddy@FreeBSD.org>2002-06-24 12:40:11 +0000
commit0f0f563b6e75a78c4b27456dd7d07bf4e7951c75 (patch)
tree30db98fb90f987965a564fb79ccf39f1459780a0 /usr.bin
parent125f718f70fbe8c4508ebe028aac04726f660bf1 (diff)
downloadFreeBSD-src-0f0f563b6e75a78c4b27456dd7d07bf4e7951c75.zip
FreeBSD-src-0f0f563b6e75a78c4b27456dd7d07bf4e7951c75.tar.gz
Fix unaligned access error.
Reviewed by: ticso
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/locate/locate/util.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/locate/locate/util.c b/usr.bin/locate/locate/util.c
index ab77699..944ca88 100644
--- a/usr.bin/locate/locate/util.c
+++ b/usr.bin/locate/locate/util.c
@@ -231,13 +231,16 @@ int
getwm(p)
caddr_t p;
{
- static char buf[INTSIZE];
+ union {
+ char buf[INTSIZE];
+ int i;
+ } u;
register int i;
for (i = 0; i < INTSIZE; i++)
- buf[i] = *p++;
+ u.buf[i] = *p++;
- i = *(int *)buf;
+ i = u.i;
if (i > MAXPATHLEN || i < -(MAXPATHLEN)) {
i = ntohl(i);
OpenPOWER on IntegriCloud