Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Oct 2005 04:22:42 -0300 (CLST)
From:      Daniel Molina Wegener <dmw@unete.cl>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/88215: [PATCH] syslogd does not pass cleanly parameters to cfline()
Message-ID:  <200510300722.j9U7Mgjc066601@hopto.org>
Resent-Message-ID: <200510300730.j9U7UGWI081981@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         88215
>Category:       bin
>Synopsis:       [PATCH] syslogd does not pass cleanly parameters to cfline()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 30 07:30:15 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Daniel Molina Wegener
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
Daniel Molina Wegener
>Environment:
System: FreeBSD dmw.hopto.org 5.4-STABLE FreeBSD 5.4-STABLE #10: Wed Oct 26 22:37:00 CLST 2005 root@dmw.hopto.org:/usr/obj/usr/src/sys/PHOBOS i386


>Description:

   In the syslogd function init(), parameters passed to cfline()
are not clean when the user attempt to use a remote host entry
as the source of syslog messages.

   Instead of a clean host name, it passes the hostname and the
last program specification in the syslog.conf file.

>How-To-Repeat:

   Put any program specification and start syslogd with -vv and -d
flags, you can see the parameters passed to cfline() function in
a list.

>Fix:

   Apply the next patch from the source tree:

--- usr.sbin/syslogd/syslogd.c.dist	Sun Oct 30 02:05:56 2005
+++ usr.sbin/syslogd/syslogd.c	Sun Oct 30 04:04:10 2005
@@ -1,3 +1,4 @@
+/* -*- mode: c; c-basic-offset: 4; c-default-style: "bsd" -*- */ 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -734,7 +735,7 @@
 			*q++ = '-';
 		}
 		if (isascii(c) && iscntrl(c)) {
-			if (c == '\n') {
+			if (c == '\n' || c == '\r') {
 				*q++ = ' ';
 			} else if (c == '\t') {
 				*q++ = '\t';
@@ -747,7 +748,6 @@
 		}
 	}
 	*q = '\0';
-
 	logmsg(pri, line, hname, 0);
 }
 
@@ -1588,6 +1588,7 @@
 				continue;
 		}
 		if (*p == '+' || *p == '-') {
+			(void)strlcpy(prog, "*", sizeof(prog));
 			host[0] = *p++;
 			while (isspace(*p))
 				p++;
@@ -1607,6 +1608,7 @@
 			continue;
 		}
 		if (*p == '!') {
+			(void)strlcpy(host, "*", sizeof(host));
 			p++;
 			while (isspace(*p)) p++;
 			if ((!*p) || (*p == '*')) {
>Release-Note:
>Audit-Trail:
>Unformatted:



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