NetBSD Problem Report #41196
From darrenr@netbsd.org Mon Apr 13 12:19:33 2009
Return-Path: <darrenr@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 5281063BD8A
for <gnats-bugs@gnats.NetBSD.org>; Mon, 13 Apr 2009 12:19:33 +0000 (UTC)
Message-Id: <20090413121933.3DDDA63B425@mail.netbsd.org>
Date: Mon, 13 Apr 2009 12:19:33 +0000 (UTC)
From: darrenr@netbsd.org
Reply-To: darrenr@netbsd.org
To: gnats-bugs@gnats.NetBSD.org
Subject: syslogd -d displays sun_path wrongly
X-Send-Pr-Version: 3.95
>Number: 41196
>Category: bin
>Synopsis: syslogd displays sun_path wrongly
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Apr 13 12:20:04 +0000 2009
>Closed-Date: Sat Sep 05 20:16:07 +0000 2015
>Last-Modified: Sat Sep 05 20:16:07 +0000 2015
>Originator: Darren Reed
>Release: NetBSD 5.0_RC3
>Organization:
NetBSD
>Environment:
Machine: i386
>Description:
When using "syslogd -d", the output that shows the unix file is
corrupt... e.g.
Unix socket (/var/run/log8Ê) active
It would seem that the kernel no longer puts a \0 in the sun_path buffer?
The fix provided here puts a limit on the length printed, without changing
the buffer... I'd commit it except that I'm in the wrong place and time and
no easy access to a cvs repo to commit from
>How-To-Repeat:
Start syslog with -d
>Fix:
Index: syslogd.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.86
diff -c -r1.86 syslogd.c
*** syslogd.c 21 Jul 2008 13:36:59 -0000 1.86
--- syslogd.c 13 Apr 2009 12:14:33 -0000
***************
*** 667,673 ****
return;
}
! dprintf("Unix socket (%s) active\n", myname.sun_path);
sunlen = sizeof(fromunix);
rv = recvfrom(fd, linebuf, MAXLINE, 0,
--- 667,682 ----
return;
}
! sunlen = myname.sun_len;
! if (sunlen > sizeof(myname))
! sunlen = sizeof(myname);
! if (sunlen >= offsetof(struct sockaddr_un, sun_path))
! sunlen -= offsetof(struct sockaddr_un, sun_path);
! else
! sunlen = 0;
!
! dprintf("Unix socket (%*.*s) active\n",
! sunlen, sunlen, myname.sun_path);
sunlen = sizeof(fromunix);
rv = recvfrom(fd, linebuf, MAXLINE, 0,
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 05 Sep 2015 20:16:07 +0000
State-Changed-Why:
fixed in head in 2008 when the encrypted syslog GSOC project was merged.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.