diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-06-26 20:12:49 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-06-26 20:12:49 +0000 |
commit | 1b7b16c7ff4105a645e8442655fe7291135b3c70 (patch) | |
tree | 4153c01a9be33be57211fd6d5232a2c4ee8d8ceb /usr.sbin | |
parent | 8448eb08833ff433c4be90f418209a80b2bbbdc6 (diff) |
Fix strict aligenment issues in ppp lcp and ipcp handling.
More cleanup is needed. OK henning@ canacar@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/ppp/ipcp.c | 9 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/lcp.c | 7 |
2 files changed, 9 insertions, 7 deletions
diff --git a/usr.sbin/ppp/ppp/ipcp.c b/usr.sbin/ppp/ppp/ipcp.c index 4a109b3ed59..41b53f4b4c2 100644 --- a/usr.sbin/ppp/ppp/ipcp.c +++ b/usr.sbin/ppp/ppp/ipcp.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: ipcp.c,v 1.38 2003/04/28 17:36:56 beck Exp $ + * $OpenBSD: ipcp.c,v 1.39 2004/06/26 20:12:48 claudio Exp $ */ #include <sys/param.h> @@ -754,7 +754,7 @@ IpcpSendConfigReq(struct fsm *fp) /* Send config REQ please */ struct physical *p = link2physical(fp->link); struct ipcp *ipcp = fsm2ipcp(fp); - u_char buff[24]; + u_char buff[MAX_FSM_OPT_LEN]; struct fsm_opt *o; o = (struct fsm_opt *)buff; @@ -1050,7 +1050,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, struct ipcp *ipcp = fsm2ipcp(fp); int gotdnsnak; u_int32_t compproto; - struct compreq *pcomp; + struct compreq *pcomp, pcompbuff; struct in_addr ipaddr, dstipaddr, have_ip; char tbuff[100], tbuff2[100]; struct fsm_opt *opt, nak; @@ -1098,7 +1098,8 @@ IpcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, break; case TY_COMPPROTO: - pcomp = (struct compreq *)opt->data; + pcomp = &pcompbuff; + memcpy(pcomp, opt->data, sizeof(pcompbuff)); compproto = (ntohs(pcomp->proto) << 16) + (pcomp->slots << 8) + pcomp->compcid; log_Printf(LogIPCP, "%s %s\n", tbuff, vj2asc(compproto)); diff --git a/usr.sbin/ppp/ppp/lcp.c b/usr.sbin/ppp/ppp/lcp.c index cbb45c83a48..7aed02ce4f7 100644 --- a/usr.sbin/ppp/ppp/lcp.c +++ b/usr.sbin/ppp/ppp/lcp.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: lcp.c,v 1.38 2003/04/07 23:58:53 deraadt Exp $ + * $OpenBSD: lcp.c,v 1.39 2004/06/26 20:12:48 claudio Exp $ */ #include <sys/param.h> @@ -660,7 +660,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, int sz, pos, op, callback_req, chap_type; u_int32_t magic, accmap; u_short mru, phmtu, maxmtu, maxmru, wantmtu, wantmru, proto; - struct lqrreq *req; + struct lqrreq *req, reqbuff; char request[20], desc[22]; struct mp *mp; struct physical *p = link2physical(fp->link); @@ -927,7 +927,8 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, break; case TY_QUALPROTO: - req = (struct lqrreq *)opt; + req = &reqbuff; + memcpy(req, opt, sizeof(reqbuff)); log_Printf(LogLCP, "%s proto %x, interval %lums\n", request, ntohs(req->proto), (u_long)ntohl(req->period) * 10); switch (mode_type) { |