make wall(1) work with pts.
This commit is contained in:
parent
bb80263411
commit
d042befb98
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154898
@ -68,14 +68,18 @@ ttymsg(struct iovec *iov, int iovcnt, const char *line, int tmout)
|
|||||||
int cnt, fd;
|
int cnt, fd;
|
||||||
static char device[MAXNAMLEN] = _PATH_DEV;
|
static char device[MAXNAMLEN] = _PATH_DEV;
|
||||||
static char errbuf[1024];
|
static char errbuf[1024];
|
||||||
|
char *p;
|
||||||
int forked;
|
int forked;
|
||||||
|
|
||||||
forked = 0;
|
forked = 0;
|
||||||
if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0])))
|
if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0])))
|
||||||
return ("too many iov's (change code in wall/ttymsg.c)");
|
return ("too many iov's (change code in wall/ttymsg.c)");
|
||||||
|
|
||||||
strlcpy(device + sizeof(_PATH_DEV) - 1, line, sizeof(device));
|
p = device + sizeof(_PATH_DEV) - 1;
|
||||||
if (strchr(device + sizeof(_PATH_DEV) - 1, '/')) {
|
strlcpy(p, line, sizeof(device));
|
||||||
|
if (strncmp(p, "pts/", 4) == 0)
|
||||||
|
p += 4;
|
||||||
|
if (strchr(p, '/') != NULL) {
|
||||||
/* A slash is an attempt to break security... */
|
/* A slash is an attempt to break security... */
|
||||||
(void) snprintf(errbuf, sizeof(errbuf),
|
(void) snprintf(errbuf, sizeof(errbuf),
|
||||||
"Too many '/' in \"%s\"", device);
|
"Too many '/' in \"%s\"", device);
|
||||||
|
Loading…
Reference in New Issue
Block a user