aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/w
diff options
context:
space:
mode:
authorDavid Greenman <dg@FreeBSD.org>1995-05-16 11:29:41 +0000
committerDavid Greenman <dg@FreeBSD.org>1995-05-16 11:29:41 +0000
commit92172c87b43ffbd1a0b786c3db286be124fcc5b8 (patch)
treec0779fb967bab62fcab51ce33ce0db948a7a985d /usr.bin/w
parentd5531570b4374a3e74163373cf1a870038d2bf41 (diff)
downloadsrc-92172c87b43ffbd1a0b786c3db286be124fcc5b8.tar.gz
src-92172c87b43ffbd1a0b786c3db286be124fcc5b8.zip
If an ut_host field in an utmp entry contains a ':' (e.g. for an xterm session)
w doesn't handle the non-'\0' terminated char arrays in struct utmp properly. Submitted by: jarle@idt.unit.no
Notes
Notes: svn path=/head/; revision=8555
Diffstat (limited to 'usr.bin/w')
-rw-r--r--usr.bin/w/w.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 0a31930ca450..ea5d2ca2bbcd 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -307,7 +307,8 @@ main(argc, argv)
p = hp->h_name;
}
if (x) {
- (void)snprintf(buf, sizeof(buf), "%s:%s", p, x);
+ (void)snprintf(buf, sizeof(buf), "%s:%.*s", p,
+ ep->utmp.ut_host + UT_HOSTSIZE - x, x);
p = buf;
}
(void)printf("%-*.*s %-2.2s %-*.*s ",