summaryrefslogtreecommitdiff
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>1999-03-31 13:33:03 +0000
committerbrian <brian@cvs.openbsd.org>1999-03-31 13:33:03 +0000
commitfec0eda9fbbbd6ca4f807830e1807cce6cb0cde6 (patch)
tree34f6b2f2ad9b9a3c55db9fac0d550141e2dc99ff /usr.sbin/ppp
parent9367b4c882f45aeded248dc43abc5bdff0875297 (diff)
Another alignment bogon.
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r--usr.sbin/ppp/ppp/slcompress.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/ppp/ppp/slcompress.c b/usr.sbin/ppp/ppp/slcompress.c
index ec2a5b328d6..c07a2b60ec0 100644
--- a/usr.sbin/ppp/ppp/slcompress.c
+++ b/usr.sbin/ppp/ppp/slcompress.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: slcompress.c,v 1.3 1999/03/30 07:57:38 brian Exp $
+ * $Id: slcompress.c,v 1.4 1999/03/31 13:33:02 brian Exp $
*
* Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
* - Initial distribution.
@@ -551,13 +551,17 @@ sl_uncompress_tcp(u_char ** bufp, int len, u_int type, struct slcompress *comp,
/* recompute the ip header checksum */
{
- register u_short *bp = (u_short *)&cs->cs_ip;
+ register u_short sum, *bp = (u_short *)&cs->cs_ip;
for (changes = 0; hlen > 0; hlen -= 2)
changes += *bp++;
changes = (changes & 0xffff) + (changes >> 16);
changes = (changes & 0xffff) + (changes >> 16);
- ((struct ip *) cp)->ip_sum = ~changes;
+
+ /* Watch out for alighment problems.... */
+ sum = ~changes;
+ bp = &((struct ip *)cp)->ip_sum;
+ memcpy(bp, &sum, sizeof *bp);
}
return (len);
bad: