diff options
author | dg <dg@FreeBSD.org> | 1995-05-16 11:29:41 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-05-16 11:29:41 +0000 |
commit | 3f349e7ec85ac3affae816bfa10292b655d4eb44 (patch) | |
tree | c0779fb967bab62fcab51ce33ce0db948a7a985d /usr.bin | |
parent | 0bde18bfa25faff70543d9ab02b6392551458d52 (diff) | |
download | FreeBSD-src-3f349e7ec85ac3affae816bfa10292b655d4eb44.zip FreeBSD-src-3f349e7ec85ac3affae816bfa10292b655d4eb44.tar.gz |
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
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/w/w.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index 0a31930..ea5d2ca 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 ", |