summaryrefslogtreecommitdiffstats
path: root/log.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2017-03-10 04:15:58 +0100
committerDarren Tucker <dtucker@zip.com.au>2017-03-10 05:25:11 +0100
commit9747b9c742de409633d4753bf1a752cbd211e2d3 (patch)
treecb42f95c6f1cbab00423d853c5b190f1d0e792d5 /log.c
parentupstream commit (diff)
downloadopenssh-9747b9c742de409633d4753bf1a752cbd211e2d3.tar.xz
openssh-9747b9c742de409633d4753bf1a752cbd211e2d3.zip
upstream commit
don't truncate off \r\n from long stderr lines; bz#2688, reported by Brian Dyson; ok dtucker@ Upstream-ID: cdfdc4ba90639af807397ce996153c88af046ca4
Diffstat (limited to 'log.c')
-rw-r--r--log.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/log.c b/log.c
index 2b59c4274..d0f86cf6f 100644
--- a/log.c
+++ b/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.48 2016/07/15 05:01:58 dtucker Exp $ */
+/* $OpenBSD: log.c,v 1.49 2017/03/10 03:15:58 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -453,7 +453,8 @@ do_log(LogLevel level, const char *fmt, va_list args)
tmp_handler(level, fmtbuf, log_handler_ctx);
log_handler = tmp_handler;
} else if (log_on_stderr) {
- snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf);
+ snprintf(msgbuf, sizeof msgbuf, "%.*s\r\n",
+ (int)sizeof msgbuf - 3, fmtbuf);
(void)write(log_stderr_fd, msgbuf, strlen(msgbuf));
} else {
#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT)