From owner-svn-src-head@freebsd.org Wed Jan 4 23:45:33 2017 Return-Path: Delivered-To: svn-src-head@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 01A28C9FC74 for ; Wed, 4 Jan 2017 23:45:33 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-it0-x232.google.com (mail-it0-x232.google.com [IPv6:2607:f8b0:4001:c0b::232]) (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 C87EF12BF for ; Wed, 4 Jan 2017 23:45:32 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: by mail-it0-x232.google.com with SMTP id o141so312754182itc.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=FPBw1zXoTAEFWOOEjHoyEoB4SRaBLd40QWgaFhCe92NLgDMxDTIOT3Eth8TWIjgekZ VM2YGAjIBucC678Rr7dXDzwxkYvuQYII49/7vSn1pETXSn1X6e/wD7tHzKpzPHtWHX8p iEWAaBIIDsViiyEJ2CPM1SYp09/rFg6uJkm3D/LH6q1UGySdYiJ99/1v+635YEhJdLpI zyombCR272in7bP2NL0p/ZAtNevV8pmFmjaxwrZ+ztNoMerczrgOHBcPrOq9QYgYnjvo CU8pZKggh5UmgrKm9BebTJ5xkaSPxlo+rcCClH9rvxwEwzYloNTK3Pa0jV2ULCtcSLNm 6dCg== X-Gm-Message-State: AIkVDXKv9iHeJ4TsAc8F+mkvDoauht4dnaTJqUfVTcRDW0U6E3lzOjFkGD/EotXrfXSj6ppsokOYssJ1XboR2A== 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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 :(