From owner-freebsd-current@FreeBSD.ORG Sat Jul 28 22:42:52 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2E43E106564A for ; Sat, 28 Jul 2012 22:42:52 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id E611C8FC08 for ; Sat, 28 Jul 2012 22:42:51 +0000 (UTC) Received: by obbun3 with SMTP id un3so8339012obb.13 for ; Sat, 28 Jul 2012 15:42:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=sDculiBhrND00D9BobO4Opa+VRnvGeabVVkiv/FrKvQ=; b=FQVmrDvWK2rQwhA914pxZ24dR3x7ZFD+/cawmNQbZLx2W64+TRxJScbrBH+g2Y9w6B dmhc6KIN+iIr46u16P4t+nMe5S3WgsNT3sK8V1HQQXn/57Xi2wjp9crnkJkDBfscy3ip RkxocviwrFHj/IRtKaJeQyb11U8Zpumiv8nLHanAs8DQxhdCzUmVweCiZwkikeE58ZxB fLzvVv7L43NxGQNqEnE6hzUps0YtcCfCf2D9+SQ1LPrsZdsB+2eo9KXS2izona8fvMt9 xVAcgCRBcOON0dXeT9/FEtgHH5qoJxbTX+HRffEeTJFDS6wb8MxaBbEpmKSLPUA2zlco FHFg== MIME-Version: 1.0 Received: by 10.60.29.230 with SMTP id n6mr10142194oeh.22.1343515371510; Sat, 28 Jul 2012 15:42:51 -0700 (PDT) Received: by 10.76.84.7 with HTTP; Sat, 28 Jul 2012 15:42:51 -0700 (PDT) In-Reply-To: References: <20120725155211.GA33971@onelab2.iet.unipi.it> Date: Sat, 28 Jul 2012 15:42:51 -0700 Message-ID: From: Garrett Cooper To: Arnaud Lacombe Content-Type: text/plain; charset=ISO-8859-1 Cc: "Bjoern A. Zeeb" , Luigi Rizzo , current@freebsd.org Subject: Re: RFC: libkern version of inet_ntoa_r X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jul 2012 22:42:52 -0000 On Sat, Jul 28, 2012 at 3:35 PM, Arnaud Lacombe wrote: > Hi, > > On Sat, Jul 28, 2012 at 6:14 PM, Bjoern A. Zeeb > wrote: >> On Wed, 25 Jul 2012, Luigi Rizzo wrote: >> >>> During some ipfw/dummynet cleanup i noticed that the libkern version of >>> inet_ntoa_r() is missing the buffer size argument that is present in >>> the libc counterpart. >>> >>> Any objection if i fix it ? >> >> >> And why exactly would you need it? What does libc do with it? Render >> partial IPv4 addresses? >> > Mitigate possibilities of memory corruption ? At the very least, allow > the following: > > { > char tmp[sizeof "255.255.255.255"]; > > KASSERT(size >= (sizeof tmp)); > [...] > } > > to be enforced... but hey, who gives a damn about consistently doing > things and enforcing code assumptions ? ;-) I think that a subtlety in Bjoern's reply was missed. Note that inet_ntoa is guaranteed to only work with IPv4, not IPv4+IPv6, like inet_ntop. Thanks, -Garrett