diff options
author | naddy <naddy@FreeBSD.org> | 2002-06-24 12:40:11 +0000 |
---|---|---|
committer | naddy <naddy@FreeBSD.org> | 2002-06-24 12:40:11 +0000 |
commit | 0f0f563b6e75a78c4b27456dd7d07bf4e7951c75 (patch) | |
tree | 30db98fb90f987965a564fb79ccf39f1459780a0 | |
parent | 125f718f70fbe8c4508ebe028aac04726f660bf1 (diff) | |
download | FreeBSD-src-0f0f563b6e75a78c4b27456dd7d07bf4e7951c75.zip FreeBSD-src-0f0f563b6e75a78c4b27456dd7d07bf4e7951c75.tar.gz |
Fix unaligned access error.
Reviewed by: ticso
-rw-r--r-- | usr.bin/locate/locate/util.c | 9 |
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); |