Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Sep 2023 15:52:37 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: cd90f3afb72a - main - syslogd: Do not print bad data
Message-ID:  <202309281552.38SFqb94022120@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=cd90f3afb72a31415996fffd46026a74d64124ea

commit cd90f3afb72a31415996fffd46026a74d64124ea
Author:     Jake Freeland <jfree@FreeBSD.org>
AuthorDate: 2023-09-01 02:50:35 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-09-28 15:51:53 +0000

    syslogd: Do not print bad data
    
    If errno is zero, then buf is never filled and we're printing
    uninitialized data. Print the msg buffer instead to mitigate this.
    
    Reviewed by:    markj, emaste
    MFC after:      3 weeks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D41371
---
 usr.sbin/syslogd/syslogd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index a37f3a9482bf..c63683efead6 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -2314,7 +2314,7 @@ logerror(const char *msg)
 		msg = buf;
 	}
 	errno = 0;
-	dprintf("%s\n", buf);
+	dprintf("%s\n", msg);
 	logmsg(LOG_SYSLOG|LOG_ERR, NULL, LocalHostName, "syslogd", NULL, NULL,
 	    NULL, msg, 0);
 	recursed--;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202309281552.38SFqb94022120>