summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2002-06-22 21:01:47 +0000
committerbrian <brian@FreeBSD.org>2002-06-22 21:01:47 +0000
commitcd63f26c91f90bdf76d47d1b7a6c1312dd9dea6b (patch)
treebf8e6c42d9fb67c50f228ac420aa0adf1148e977 /usr.sbin/ppp
parentc8d1b9c9f6c963f078b5c1a6bd397cff34c5fe0b (diff)
downloadFreeBSD-src-cd63f26c91f90bdf76d47d1b7a6c1312dd9dea6b.zip
FreeBSD-src-cd63f26c91f90bdf76d47d1b7a6c1312dd9dea6b.tar.gz
Don't expect NUL terminated data in all netgraph messages received.
Only display message hook values we understand.
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r--usr.sbin/ppp/ether.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/ppp/ether.c b/usr.sbin/ppp/ether.c
index 9c3f752..0621216 100644
--- a/usr.sbin/ppp/ether.c
+++ b/usr.sbin/ppp/ether.c
@@ -221,7 +221,7 @@ ether_MessageIn(struct etherdevice *dev)
struct timeval t;
fd_set *r;
u_long slot;
- int ret;
+ int asciilen, ret;
if (dev->cs < 0)
return;
@@ -254,6 +254,7 @@ ether_MessageIn(struct etherdevice *dev)
return;
}
+ asciilen = 0;
switch (rep->header.cmd) {
case NGM_PPPOE_SET_FLAG: msg = "SET_FLAG"; break;
case NGM_PPPOE_CONNECT: msg = "CONNECT"; break;
@@ -267,6 +268,7 @@ ether_MessageIn(struct etherdevice *dev)
msg = "ACNAME";
if (setenv("ACNAME", sts->hook, 1) != 0)
log_Printf(LogWARN, "setenv: cannot set ACNAME=%s: %m", sts->hook);
+ asciilen = rep->header.arglen;
break;
case NGM_PPPOE_SESSIONID:
msg = "SESSIONID";
@@ -285,7 +287,11 @@ ether_MessageIn(struct etherdevice *dev)
break;
}
- log_Printf(LogPHASE, "Received NGM_PPPOE_%s (hook \"%s\")\n", msg, sts->hook);
+ if (asciilen)
+ log_Printf(LogPHASE, "Received NGM_PPPOE_%s (hook \"%.*s\")\n",
+ msg, asciilen, sts->hook);
+ else
+ log_Printf(LogPHASE, "Received NGM_PPPOE_%s\n", msg);
switch (rep->header.cmd) {
case NGM_PPPOE_SUCCESS:
OpenPOWER on IntegriCloud