From: mikeb Date: Fri, 12 Jun 2015 14:18:25 +0000 (+0000) Subject: Perform a copy with a memmove for potentially overlapping regions. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7f8ecfe261051ed5f902afcd3a9d656a632aefdc;p=openbsd Perform a copy with a memmove for potentially overlapping regions. Reported and fixed by Sergey Ryazanov , thanks! --- diff --git a/usr.sbin/pppd/lcp.c b/usr.sbin/pppd/lcp.c index 9f73296f892..d09659d0e9c 100644 --- a/usr.sbin/pppd/lcp.c +++ b/usr.sbin/pppd/lcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lcp.c,v 1.11 2015/01/15 23:19:48 tedu Exp $ */ +/* $OpenBSD: lcp.c,v 1.12 2015/06/12 14:18:25 mikeb Exp $ */ /* * lcp.c - PPP Link Control Protocol. @@ -1441,7 +1441,7 @@ endswitch: if (orc == CONFREJ) { /* Reject this CI */ rc = CONFREJ; if (cip != rejp) /* Need to move rejected CI? */ - BCOPY(cip, rejp, cilen); /* Move it */ + BMOVE(cip, rejp, cilen); /* Move it (NB: overlapped regions) */ INCPTR(cilen, rejp); /* Update output pointer */ } } diff --git a/usr.sbin/pppd/pppd.h b/usr.sbin/pppd/pppd.h index eaef54aa4db..76f59067a33 100644 --- a/usr.sbin/pppd/pppd.h +++ b/usr.sbin/pppd/pppd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pppd.h,v 1.18 2015/01/16 06:40:19 deraadt Exp $ */ +/* $OpenBSD: pppd.h,v 1.19 2015/06/12 14:18:25 mikeb Exp $ */ /* * pppd.h - PPP daemon global declarations. @@ -402,6 +402,7 @@ extern struct option_info devnam_info; #define UNTIMEOUT(r, f) untimeout((r), (f)) #define BCOPY(s, d, l) memcpy(d, s, l) +#define BMOVE(s, d, l) memmove(d, s, l) #define BZERO(s, n) memset(s, 0, n) #define EXIT(u) quit()