summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2015-06-12 14:18:26 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2015-06-12 14:18:26 +0000
commit7cf98e910d027bbf529610b665cd1b3991643cf1 (patch)
tree4afd732dda154b6b3a6409958bd299191907c25b
parentcc94ef580916d76a56deabbad43a35eb663245ed (diff)
Perform a copy with a memmove for potentially overlapping regions.
Reported and fixed by Sergey Ryazanov <ryazanov ! s ! a at gmail ! com>, thanks!
-rw-r--r--usr.sbin/pppd/lcp.c4
-rw-r--r--usr.sbin/pppd/pppd.h3
2 files changed, 4 insertions, 3 deletions
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()