From owner-svn-src-all@freebsd.org Wed Jan 4 23:45:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 131D6C9FC76 for ; Wed, 4 Jan 2017 23:45:33 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D349412C2 for ; Wed, 4 Jan 2017 23:45:32 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: by mail-it0-x230.google.com with SMTP id c20so316521695itb.0 for ; Wed, 04 Jan 2017 15:45:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=clockworksquid.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=r58Z7HwALie7FbNNvDktjc+gr49q4rkXL95RIaapBL0=; b=UQFyf9N02Eto9hy73lEA5PdvLpEaWsP7aTY/XFmXy71lBalFILHIROY5smTC0YWQmj zjGvsgG779N1eF9nPlF/6BS2kf4471eP8B/IaDzpg0apPiOZhQZQTL5ckNo8YP47zeZE niNxN+w6kk/EUkJ2R3zpO0AurzxDqRL0D7Mhg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=r58Z7HwALie7FbNNvDktjc+gr49q4rkXL95RIaapBL0=; b=bP/LQzhQGFj2rIRloYb7Qt7Q+M2QWgxSufBYpXFlRkQHfWNJvd2H3sjOM6DuVp/wh/ HKA3ptutbl275socCYVl2oKycTY6L8HrV9T77iaHax/r5OYBLyPf2/XriQ0ylhDox81e h9Umaf7Q7y0xlZJTypPpVBkgYNbB6kCtyMG3X9wgEaF5PrGC4n13pnKmTxsQtKZwfM6u 8y/FiSEBGN/rL2ItVGs+bqpi1iWBIlCk+6E9D4ZCs+gP4rk5DbfMbXhtM4OEII5JBZJH LZftxe+vyw0rIIUHR8jjxvFx7mPzAT6qWodvaocRwkh4kzF/hVAVjGKSY4b3YmpJpZ8r NEPw== X-Gm-Message-State: AIkVDXLo10doWgVsOBts4fT/tPOlJk4LdMpKhsOMnjP1PYcuc6TpdYOnze9bWtLNrHnT8onZniwo0T/tyTlgDg== X-Received: by 10.36.130.131 with SMTP id t125mr35277134itd.49.1483573531928; Wed, 04 Jan 2017 15:45:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.50.210 with HTTP; Wed, 4 Jan 2017 15:45:11 -0800 (PST) In-Reply-To: <20170104233650.GB17765@stack.nl> References: <201701040246.v042kaEh039041@repo.freebsd.org> <20170104233650.GB17765@stack.nl> From: Juli Mallett Date: Wed, 4 Jan 2017 15:45:11 -0800 Message-ID: Subject: Re: svn commit: r311233 - head/contrib/netbsd-tests/fs/tmpfs To: Jilles Tjoelker Cc: Ngie Cooper , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 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: Wed, 04 Jan 2017 23:45:33 -0000 On Wed, Jan 4, 2017 at 3:36 PM, Jilles Tjoelker wrote: > On Wed, Jan 04, 2017 at 02:46:36AM +0000, Ngie Cooper wrote: >> - Initialize .sun_len before passing it to strlcpy and bind. > It would be better to avoid naming the non-portable sun_len field if it > is just to make Coverity happy. I suggest initializing the structure > with designated initializers or memset(). > > Apart from that, the value for sun_len is wrong; it should be the length > of the whole structure and not just the sun_path part. Fortunately, the > field is ignored by bind(), which uses the addrlen parameter instead. This is incorrect, too. It's the length of the sockaddr_un header plus the actual length of the pathname, not the available size of the path field. It's kind of awful that it's inconsistent with the other sockaddr types, but that's the fun of sockaddr_un, to accommodate the fact that the path name is naturally a variable-length field. In fact, the calculation here seems to be wrong, also; we have the SUN_LEN macro in for a reason, and it's what the unix(4) manpage suggests. Of course, sun_len is sort of needlessly obscure and in general it's best for us to fix anything which requires the _len fields to be accurate, and to just ignore them :(