From owner-svn-src-all@freebsd.org Sun Jan 28 02:27:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FFDEED3056 for ; Sun, 28 Jan 2018 02:27:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic312-37.consmr.mail.ne1.yahoo.com (sonic312-37.consmr.mail.ne1.yahoo.com [66.163.191.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E698786A70 for ; Sun, 28 Jan 2018 02:27:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1517106468; bh=7Z+TCps5K8hK3gwfv0MAbDRVDroI6Eb4Ur5H9lwbFiI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=b+oEOkIRedvjuuGJM9SIuvmia87ZCpcysqKHGUquCpCJHufw6p2fjtcl+cQrktGtdkinRP2hcYr1GQQTv0NOSz2MbDYfnJkF/oD9DQHdtwr8LgaOB1GuG4nyR9JDGGJrmIB2LnWtrpPG9QRokNqkSKzdWVNEJi8RsiZIBiesp+rtfWgZnO62E8Z27StG+kHD/zQOqlwHp+nhjz3yX7oH7lRJzUD7SIZZcl6UmV5XjrJ9f7dmIcDPtg92rEFEVNE+Gr+EfGRv7ciZw4/FcQuDKoagwfef9rNSubyCti6mLxrQmwrdVURP/IZPcXWq3XfJgbdzNb0DJxtVmt/uNCrglg== X-YMail-OSG: 4lYgNnEVM1nDc1p56MOdLshD59bxcoYS0wLd1zskLBMv8djEKWRTdIpOeTmuefK F0cLcn5fq09nJnl0a3wgUw.heQCtW0SiBZq3VpD2gaJ5jfmSJmWn4TeXZyucT03Xt8QCJRL3jOdG a6J2efcLnTgdtf8HqF0WpnK.KdnDyhMlGBUKZo1WxFmSp._tfwUX53vwhOnTphdBzKk7PbumHPyI TZS1NK2vJUlv8K6fEmkMrURqO1H34cB9nZXwje3RpRwKO5_9X.eUg7T_Sm0wKt26ljcZSj7zzBSW Kk5LZZEuuF52GLX0qZ6638w_JzHiPwX8NCP1DZTKAaXEdPdmTqRsxLIZ5jYIsL8FSMz1UVxbfczl 2U36YnV9MoZNRgjEojIq83JX6qqpQ2YU4tlAOrZ8OP9btDIxSTwuxhtMYvFtPzoszV8TakHWsbRL UxAKtj2FAydUFhzy5FQXAr5LhedZ6DoPfub5mtyRHEOxpKC.rotUBHPzQa6Rn5qelQA202qSsr8J mhXTaY0TJHw-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ne1.yahoo.com with HTTP; Sun, 28 Jan 2018 02:27:48 +0000 Received: from smtpgate105.mail.ne1.yahoo.com (EHLO [192.168.0.8]) ([216.155.193.135]) by smtp402.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 9ac1d834536b6f16cdb53c4b474e3854; Sun, 28 Jan 2018 02:27:45 +0000 (UTC) Subject: Re: svn commit: r328492 - head/contrib/opie/libopie To: Bruce Evans Cc: Dimitry Andric , Ed Schouten , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801272216.w0RMGJwo057492@repo.freebsd.org> <7C471160-44B3-4EA6-8995-08A4EB4332A1@FreeBSD.org> <20180128093811.G4029@besplex.bde.org> <5c39c37d-8d0a-22e9-710b-2453e0dd4481@FreeBSD.org> <20180128121851.U4596@besplex.bde.org> From: Pedro Giffuni Message-ID: <0e2f6c82-3036-29ef-bf09-15d4e5623020@FreeBSD.org> Date: Sat, 27 Jan 2018 21:27:46 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180128121851.U4596@besplex.bde.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jan 2018 02:27:55 -0000 On 01/27/18 20:42, Bruce Evans wrote: > On Sat, 27 Jan 2018, Pedro Giffuni wrote: > >> On 01/27/18 18:21, Bruce Evans wrote: >>> On Sat, 27 Jan 2018, Dimitry Andric wrote: >>> >>>> On 27 Jan 2018, at 23:20, Ed Schouten wrote: > >> * [... context lost to corruption of spaces which makes it unreadable] > >>>>> >>>>> Wait... This may access utmp.ut_host one byte past the end and no >>>>> longer guarantees that host is null-terminated, right? >>> >>>> No, strncpy "copies at most len characters from src into dst".  >>>> However, >>> >>> No, the change breaks the length so 1 byte past the end is accessed >>> in implementations where ut_host is not guaranteed to be NUL terminated >>> and the current instance of ut_host is not NUL terminated. >>> >> The main change is in the sizeof(). Regularly you should use the size >> of destination not the source, and apparently GCC8 decided there was >> something to check there. > > That is the main breakage.  Using the size of the destination is very > wrong, > since that size is intentionally 1 larger than the size of the source, to > leave space for appending a NUL. > I am considering reverting the change. Looking at other ways to get rid of the warning, please be patient. >> ... >> Looking in detail, upstream (which appears to have disappeared) does >> have the explicit NULL termination in our last import. For >> consistency and given that we already have a strlcpy in that code, we >> should use strlcpy() there. Every modern OS out there has strlcpy(3) >> and if not they can figure out what to do. > > strlcpy() still seems to be intentionally left out of glibc. > glibc is not portable. I understand some systems that carry glibc also carry libbsd, or they can still use musl: https://github.com/esmil/musl/blob/master/src/string/strlcpy.c Pedro.