Date: Wed, 14 Dec 2016 05:56:31 +0900 (JST) From: Hiroki Sato <hrs@FreeBSD.org> To: cem@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r309933 - head/usr.sbin/syslogd Message-ID: <20161214.055631.1082998771679292922.hrs@allbsd.org> In-Reply-To: <CAG6CVpV=nshki9k8DM-4Cni1gTJ8U-Eh1t8D9KfUqo0MKnC=wA@mail.gmail.com> References: <201612121933.uBCJXen2093959@repo.freebsd.org> <CAG6CVpV=nshki9k8DM-4Cni1gTJ8U-Eh1t8D9KfUqo0MKnC=wA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
----Security_Multipart(Wed_Dec_14_05_56_31_2016_032)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Conrad Meyer <cem@freebsd.org> wrote in <CAG6CVpV=nshki9k8DM-4Cni1gTJ8U-Eh1t8D9KfUqo0MKnC=wA@mail.gmail.com>: ce> On Mon, Dec 12, 2016 at 11:33 AM, Hiroki Sato <hrs@freebsd.org> wrote: ce> > Author: hrs ce> > Date: Mon Dec 12 19:33:40 2016 ce> > New Revision: 309933 ce> > URL: https://svnweb.freebsd.org/changeset/base/309933 ce> > ce> > Log: ce> > - Refactor listening socket list. All of the listening sockets are ce> > now maintained in a single linked-list in a transport-independent manner. ce> > - Use queue.h for linked-list structure. ce> > - Use linked-list for AllowedPeers. ce> > - Use getaddrinfo(8) even for Unix Domain sockets. ce> > - Use macros to type-casting from/to struct sockaddr{,_in,_in6}. ce> > - Define fu_* macro for union f_un to shorten the member names. ce> > - Remove an extra #include <sys/type.h>. ce> > - Add "static" to non-exported symbols. ce> > - !INET support is still incomplete but will be fixed later. ce> > ce> > There is no functional change except for some minor debug messages. ce> ce> Hello Hiroki, ce> ce> This refactor introduced a bug in the IPv6 address comparison/rejection logic. ce> ce> > Modified: head/usr.sbin/syslogd/syslogd.c ce> > ============================================================================== ce> > --- head/usr.sbin/syslogd/syslogd.c Mon Dec 12 19:26:55 2016 (r309932) ce> > +++ head/usr.sbin/syslogd/syslogd.c Mon Dec 12 19:33:40 2016 (r309933) ce> > ... ce> > reject = 0; ce> > - for (j = 0; j < 16; j += 4) { ce> > - if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m6p->sin6_addr.s6_addr[j]) ce> > - != *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) { ce> > - ++reject; ce> > - break; ce> > - } ce> > + if (IN6_ARE_MASKED_ADDR_EQUAL(&sin6->sin6_addr, ce> > + &a6p->sin6_addr, &m6p->sin6_addr) != 0) { ce> > + ++reject; ce> > + break; ce> > } ce> > if (reject) { ce> > dprintf("rejected in rule %d due to IP mismatch.\n", i); ce> ce> The new check isn't a loop, so the 'break' breaks out of the outer ce> loop, which is unintentional. I think we should just remove 'break'. ce> ce> This was found by Coverity CID 1366941. Oh, it was my mistake. Thank you for pointing out it. Fixed in r310035 just now. -- Hiroki ----Security_Multipart(Wed_Dec_14_05_56_31_2016_032)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAlhQYH8ACgkQTyzT2CeTzy1alQCgh0NueEwmT5f9vfG3EN5lWbfz 64kAnjvCUCIu0mEtMg5kKzW+fIRr8Bq1 =WD3C -----END PGP SIGNATURE----- ----Security_Multipart(Wed_Dec_14_05_56_31_2016_032)----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20161214.055631.1082998771679292922.hrs>