diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-07-18 22:22:20 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-07-18 22:22:20 +0000 |
commit | 98005da9bda57d9209b2fb2782ff23876cdcfd41 (patch) | |
tree | 95154fb3ca146cf4913ec0ee4521b2dd7afdb239 | |
parent | f00db77686555eca3f3193436de5a892a45feeca (diff) |
Both syslog(3) and syslogd(8) truncate the message at 8192 bytes.
Do the same in sendsyslog(2) and document the behavior.
reported by Ilja Van Sprundel; OK millert@ deraadt@
-rw-r--r-- | lib/libc/sys/sendsyslog.2 | 9 | ||||
-rw-r--r-- | sys/kern/subr_log.c | 5 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/libc/sys/sendsyslog.2 b/lib/libc/sys/sendsyslog.2 index 9931b09d1c1..417322cb3ff 100644 --- a/lib/libc/sys/sendsyslog.2 +++ b/lib/libc/sys/sendsyslog.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sendsyslog.2,v 1.8 2016/03/22 13:09:08 bluhm Exp $ +.\" $OpenBSD: sendsyslog.2,v 1.9 2017/07/18 22:22:19 bluhm Exp $ .\" .\" Copyright (c) 2014 Theo de Raadt .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: March 22 2016 $ +.Dd $Mdocdate: July 18 2017 $ .Dt SENDSYSLOG 2 .Os .Sh NAME @@ -33,6 +33,11 @@ function is used to transmit a formatted message direct to .Xr syslogd 8 without requiring the allocation of a socket. +The +.Fa msg +is not NUL terminated and its +.Fa len +is limited to 8192 bytes. If .Dv LOG_CONS is specified in the diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index b71add74a5d..1eee7715a25 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_log.c,v 1.50 2017/03/27 11:45:49 bluhm Exp $ */ +/* $OpenBSD: subr_log.c,v 1.51 2017/07/18 22:22:19 bluhm Exp $ */ /* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */ /* @@ -418,6 +418,9 @@ dosendsyslog(struct proc *p, const char *buf, size_t nbyte, int flags, size_t i, len; int error; + if (nbyte > 8192) + nbyte = 8192; + /* Global variable syslogf may change during sleep, use local copy. */ fp = syslogf; if (fp) |