summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/fsm.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1998-09-04 18:26:00 +0000
committerbrian <brian@FreeBSD.org>1998-09-04 18:26:00 +0000
commit7141a89d605882282983a4ffb1493e50d05201cb (patch)
treed2d14dc7a91337712aa9e76392d2353567892cea /usr.sbin/ppp/fsm.c
parent742fe357a3e83288880ecf1af6e9eb9cae89e62b (diff)
downloadFreeBSD-src-7141a89d605882282983a4ffb1493e50d05201cb.zip
FreeBSD-src-7141a89d605882282983a4ffb1493e50d05201cb.tar.gz
Don't cast potentially unaligned addresses to pointers to
non-char types on non-i386 architectures. On Alpha and Sparc we get a bus error if we do.
Diffstat (limited to 'usr.sbin/ppp/fsm.c')
-rw-r--r--usr.sbin/ppp/fsm.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/ppp/fsm.c b/usr.sbin/ppp/fsm.c
index dc5913f..9cc3fd5 100644
--- a/usr.sbin/ppp/fsm.c
+++ b/usr.sbin/ppp/fsm.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: fsm.c,v 1.35 1998/06/30 23:04:15 brian Exp $
+ * $Id: fsm.c,v 1.36 1998/08/01 01:02:41 brian Exp $
*
* TODO:
*/
@@ -31,6 +31,7 @@
#include <string.h>
#include <termios.h>
+#include "ua.h"
#include "mbuf.h"
#include "log.h"
#include "defs.h"
@@ -848,14 +849,14 @@ FsmRecvEchoReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
if (lcp) {
cp = MBUF_CTOP(bp);
- magic = ntohl(*(u_int32_t *)cp);
+ ua_ntohl(cp, &magic);
if (magic != lcp->his_magic) {
log_Printf(fp->LogLevel, "%s: RecvEchoReq: Error: His magic is bad!!\n",
fp->link->name);
/* XXX: We should send terminate request */
}
if (fp->state == ST_OPENED) {
- *(u_int32_t *)cp = htonl(lcp->want_magic); /* local magic */
+ ua_htonl(&lcp->want_magic, cp); /* local magic */
fsm_Output(fp, CODE_ECHOREP, lhp->id, cp, mbuf_Length(bp));
}
}
@@ -869,7 +870,7 @@ FsmRecvEchoRep(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
u_int32_t magic;
if (lcp) {
- magic = ntohl(*(u_int32_t *)MBUF_CTOP(bp));
+ ua_ntohl(MBUF_CTOP(bp), &magic);
/* Tolerate echo replies with either magic number */
if (magic != 0 && magic != lcp->his_magic && magic != lcp->want_magic) {
log_Printf(LogWARN,
OpenPOWER on IntegriCloud