summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2013-10-09 16:33:05 +0000
committermillert <millert@openbsd.org>2013-10-09 16:33:05 +0000
commit9ee5353ba5d7eb329208353bc5d9bdc3e8f3ee75 (patch)
tree237c132bc2bb71ee14255733572f2e64dda8c838
parenttweak previous; (diff)
downloadwireguard-openbsd-9ee5353ba5d7eb329208353bc5d9bdc3e8f3ee75.tar.xz
wireguard-openbsd-9ee5353ba5d7eb329208353bc5d9bdc3e8f3ee75.zip
Trim leading white space from the message before trying to extract
the program name. Works around a problem with the ObiHai 202's syslog client (and possibly others) where an extra space is added to the message before the program name. OK krw@ henning@ deraadt@
-rw-r--r--usr.sbin/syslogd/syslogd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 64cf528c253..8b771ca6066 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslogd.c,v 1.107 2013/04/16 19:24:55 deraadt Exp $ */
+/* $OpenBSD: syslogd.c,v 1.108 2013/10/09 16:33:05 millert Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -745,7 +745,9 @@ logmsg(int pri, char *msg, char *from, int flags)
prilev = LOG_PRI(pri);
/* extract program name */
- for(i = 0; i < NAME_MAX; i++) {
+ while (isspace(*msg))
+ msg++;
+ for (i = 0; i < NAME_MAX; i++) {
if (!isalnum(msg[i]) && msg[i] != '-')
break;
prog[i] = msg[i];