From b93addb6d667b36bdbb298b8b3c581c1738c0c9f Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 7 Jan 2003 17:04:18 +1100 Subject: - (djm) Bug #111: Run syslog and stderr logging through strnvis to eliminate nasties. Report from peak@argo.troja.mff.cuni.cz --- log.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'log.c') diff --git a/log.c b/log.c index 96626d7d4..ead7e9028 100644 --- a/log.c +++ b/log.c @@ -386,11 +386,14 @@ do_log(LogLevel level, const char *fmt, va_list args) } else { vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); } + /* Escape magic chars in output. */ + strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_OCTAL); + if (log_on_stderr) { - fprintf(stderr, "%s\r\n", msgbuf); + fprintf(stderr, "%s\r\n", fmtbuf); } else { openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility); - syslog(pri, "%.500s", msgbuf); + syslog(pri, "%.500s", fmtbuf); closelog(); } } -- cgit v1.2.3 From 0946d876f9b7abea25eb0d617b1860575937e5f4 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 14 Jan 2003 22:22:43 +1100 Subject: - markus@cvs.openbsd.org 2003/01/11 18:29:43 [log.c] set fatal_cleanups to NULL in fatal_remove_all_cleanups(); dtucker@zip.com.au --- ChangeLog | 6 +++++- log.c | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'log.c') diff --git a/ChangeLog b/ChangeLog index 25d6c6c0e..94fe477d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ - fgsch@cvs.openbsd.org 2003/01/10 23:23:24 [sftp-int.c] typo; from Nils Nordman . + - markus@cvs.openbsd.org 2003/01/11 18:29:43 + [log.c] + set fatal_cleanups to NULL in fatal_remove_all_cleanups(); + dtucker@zip.com.au 20030113 - (djm) Rework openbsd-compat/setproctitle.c a bit: move emulation type @@ -1006,4 +1010,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2567 2003/01/14 11:22:11 djm Exp $ +$Id: ChangeLog,v 1.2568 2003/01/14 11:22:43 djm Exp $ diff --git a/log.c b/log.c index ead7e9028..84e4ce0ac 100644 --- a/log.c +++ b/log.c @@ -34,7 +34,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: log.c,v 1.24 2002/07/19 15:43:33 markus Exp $"); +RCSID("$OpenBSD: log.c,v 1.25 2003/01/11 18:29:43 markus Exp $"); #include "log.h" #include "xmalloc.h" @@ -233,6 +233,7 @@ fatal_remove_all_cleanups(void) next_cu = cu->next; xfree(cu); } + fatal_cleanups = NULL; } /* Cleanup and exit */ -- cgit v1.2.3