From 3b135f2f6bfed6b789428ce6bcf49577d619ee80 Mon Sep 17 00:00:00 2001 From: Alex Hornung Date: Wed, 2 Sep 2009 07:26:29 +0100 Subject: [PATCH] wall(1) - Fix for unix98 ptys * Wall didn't know about unix98 ptys, so it errored out about too many slashes in the terminal name, as pts/X, still contains a slash. Obtained-from: FreeBSD --- usr.bin/wall/ttymsg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr.bin/wall/ttymsg.c b/usr.bin/wall/ttymsg.c index 783083690c..6dc81f5e31 100644 --- a/usr.bin/wall/ttymsg.c +++ b/usr.bin/wall/ttymsg.c @@ -64,14 +64,18 @@ ttymsg(struct iovec *iov, int iovcnt, const char *line, int tmout) int cnt, fd; static char device[PATH_MAX] = _PATH_DEV; static char errbuf[1024]; + char *p; int forked; forked = 0; if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0]))) return ("too many iov's (change code in wall/ttymsg.c)"); - strlcpy(device + sizeof(_PATH_DEV) - 1, line, sizeof(device)); - if (strchr(device + sizeof(_PATH_DEV) - 1, '/')) { + p = device + sizeof(_PATH_DEV) - 1; + strlcpy(p, line, sizeof(device)); + if (!strncmp(p, "pts/", 4)) + p += 4; + if (strchr(p, '/') != NULL) { /* A slash is an attempt to break security... */ (void) snprintf(errbuf, sizeof(errbuf), "Too many '/' in \"%s\"", device); -- 2.41.0