svn commit: r326103 - stable/11/usr.sbin/syslogd
Gleb Smirnoff
glebius at FreeBSD.org
Wed Nov 22 21:20:28 UTC 2017
Author: glebius
Date: Wed Nov 22 21:20:26 2017
New Revision: 326103
URL: https://svnweb.freebsd.org/changeset/base/326103
Log:
MFC r325558:
When parsing UDP messages skip optional hostname as described by
RFC 3164.
PR: 200933
Submitted by: maxim
Reported by: Konstantin Pavlov <thresh nginx.com>
Modified:
stable/11/usr.sbin/syslogd/syslogd.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/usr.sbin/syslogd/syslogd.c
==============================================================================
--- stable/11/usr.sbin/syslogd/syslogd.c Wed Nov 22 20:27:46 2017 (r326102)
+++ stable/11/usr.sbin/syslogd/syslogd.c Wed Nov 22 21:20:26 2017 (r326103)
@@ -972,7 +972,7 @@ static void
logmsg(int pri, const char *msg, const char *from, int flags)
{
struct filed *f;
- int i, fac, msglen, omask, prilev;
+ int i, j, fac, msglen, omask, prilev;
const char *timestamp;
char prog[NAME_MAX+1];
char buf[MAXLINE+1];
@@ -1018,6 +1018,19 @@ logmsg(int pri, const char *msg, const char *from, int
}
prilev = LOG_PRI(pri);
+
+ /* skip hostname, see RFC 3164 */
+ for (i = 0, j = 0; i < NAME_MAX; i++) {
+ if (isspace(msg[i])) {
+ j = i + 1;
+ }
+ if (msg[i] == ':')
+ break;
+ }
+ if (j <= msglen) {
+ msg += j;
+ msglen -= j;
+ }
/* extract program name */
for (i = 0; i < NAME_MAX; i++) {
More information about the svn-src-stable-11
mailing list