Some syslog messages delimit the program tag with whitespace rather

than a colon, so don't allow whitespace in program names. To be
consistent with hostnames, don't allow whitespace in the program
name specifiers in syslog.conf either.

(The first change is by Markus from the PR, the second is mine.)

PR:		68691
Submitted by:	Markus Oestreicher <m.oe@x-trader.de>
MFC after:	3 weeks
This commit is contained in:
David Malone 2004-12-28 21:58:54 +00:00
parent 7f456a7d61
commit 62f29f306a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=139381

View File

@ -921,7 +921,7 @@ logmsg(int pri, const char *msg, const char *from, int flags)
/* extract program name */
for (i = 0; i < NAME_MAX; i++) {
if (!isprint(msg[i]) || msg[i] == ':' || msg[i] == '[' ||
msg[i] == '/')
msg[i] == '/' || isspace(msg[i]))
break;
prog[i] = msg[i];
}
@ -1608,7 +1608,7 @@ init(int signo)
continue;
}
for (i = 0; i < NAME_MAX; i++) {
if (!isprint(p[i]))
if (!isprint(p[i]) || isspace(p[i]))
break;
prog[i] = p[i];
}