svn commit: r328551 - head/usr.sbin/pppctl
Pedro F. Giffuni
pfg at FreeBSD.org
Mon Jan 29 14:23:45 UTC 2018
Author: pfg
Date: Mon Jan 29 14:23:44 2018
New Revision: 328551
URL: https://svnweb.freebsd.org/changeset/base/328551
Log:
pppctl88) Avoid strcpy() copies on overlapping string.
This may lead to unpredicatable behaviour on different platforms or C
library implementations. Use an intermediate variable.
Obtained from: DragonFlyBSD (git a861a526)
Modified:
head/usr.sbin/pppctl/pppctl.c
Modified: head/usr.sbin/pppctl/pppctl.c
==============================================================================
--- head/usr.sbin/pppctl/pppctl.c Mon Jan 29 14:15:44 2018 (r328550)
+++ head/usr.sbin/pppctl/pppctl.c Mon Jan 29 14:23:44 2018 (r328551)
@@ -121,6 +121,7 @@ static int
Receive(int fd, int display)
{
static char Buffer[LINELEN];
+ char temp[sizeof(Buffer)];
struct timeval t;
int Result;
char *last;
@@ -185,7 +186,8 @@ Receive(int fd, int display)
else
flush = last - Buffer + 1;
write(STDOUT_FILENO, Buffer, flush);
- strcpy(Buffer, Buffer + flush);
+ strcpy(temp, Buffer + flush);
+ strcpy(Buffer, temp);
len -= flush;
}
if ((Result = select(fd + 1, &f, NULL, NULL, &t)) <= 0) {
More information about the svn-src-all
mailing list