NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/41196: syslogd -d displays sun_path wrongly



>Number:         41196
>Category:       bin
>Synopsis:       syslogd displays sun_path wrongly
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 13 12:20:04 +0000 2009
>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,



Home | Main Index | Thread Index | Old Index