git: cd90f3afb72a - main - syslogd: Do not print bad data
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 28 Sep 2023 15:52:37 UTC
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--;