diff options
author | brian <brian@FreeBSD.org> | 2002-03-05 13:03:11 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2002-03-05 13:03:11 +0000 |
commit | ca8983659dde8fdcc8d88650a1c0388efeb4120e (patch) | |
tree | 9b6505f42ccfcb0b5383b6e9282e962744106f74 /usr.sbin/ppp | |
parent | 8daae10e982edfc00931cc0d0b2f0d6e1cb8ea14 (diff) | |
download | FreeBSD-src-ca8983659dde8fdcc8d88650a1c0388efeb4120e.zip FreeBSD-src-ca8983659dde8fdcc8d88650a1c0388efeb4120e.tar.gz |
Don't drop the last character from ut_line in ID0logout().
PR: 35531
MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/id.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/usr.sbin/ppp/id.c b/usr.sbin/ppp/id.c index 8950239..15676db 100644 --- a/usr.sbin/ppp/id.c +++ b/usr.sbin/ppp/id.c @@ -220,17 +220,18 @@ void ID0logout(const char *device, int nologout) { struct utmp ut; + char ut_line[sizeof ut.ut_line + 1]; - strncpy(ut.ut_line, device, sizeof ut.ut_line - 1); - ut.ut_line[sizeof ut.ut_line - 1] = '\0'; + strncpy(ut_line, device, sizeof ut_line - 1); + ut_line[sizeof ut_line - 1] = '\0'; ID0set0(); - if (nologout || logout(ut.ut_line)) { - log_Printf(LogID0, "logout(\"%s\")\n", ut.ut_line); - logwtmp(ut.ut_line, "", ""); - log_Printf(LogID0, "logwtmp(\"%s\", \"\", \"\")\n", ut.ut_line); + if (nologout || logout(ut_line)) { + log_Printf(LogID0, "logout(\"%s\")\n", ut_line); + logwtmp(ut_line, "", ""); + log_Printf(LogID0, "logwtmp(\"%s\", \"\", \"\")\n", ut_line); } else - log_Printf(LogERROR, "ID0logout: No longer logged in on %s\n", ut.ut_line); + log_Printf(LogERROR, "ID0logout: No longer logged in on %s\n", ut_line); ID0setuser(); } |