diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/log.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/ssh/log.c b/usr.bin/ssh/log.c index 24744f2fd19..c14ed9098c5 100644 --- a/usr.bin/ssh/log.c +++ b/usr.bin/ssh/log.c @@ -34,12 +34,13 @@ */ #include "includes.h" -RCSID("$OpenBSD: log.c,v 1.27 2003/05/18 23:22:01 deraadt Exp $"); +RCSID("$OpenBSD: log.c,v 1.28 2003/05/24 09:02:22 djm Exp $"); #include "log.h" #include "xmalloc.h" #include <syslog.h> +#include <vis.h> static LogLevel log_level = SYSLOG_LEVEL_INFO; static int log_on_stderr = 1; @@ -380,12 +381,13 @@ do_log(LogLevel level, const char *fmt, va_list args) } else { vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); } + strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_SAFE|VIS_OCTAL); if (log_on_stderr) { - snprintf(fmtbuf, sizeof fmtbuf, "%s\r\n", msgbuf); - write(STDERR_FILENO, fmtbuf, strlen(fmtbuf)); + snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf); + write(STDERR_FILENO, msgbuf, strlen(msgbuf)); } else { openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata); - syslog_r(pri, &sdata, "%.500s", msgbuf); + syslog_r(pri, &sdata, "%.500s", fmtbuf); closelog_r(&sdata); } } |