From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id DB89E255 for ; Wed, 19 Sep 2018 11:41:34 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7300321C86; Wed, 19 Sep 2018 05:41:34 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 19 Sep 2018 05:41:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=j2jtNVOHJ+EdQ5lEDWHDeNtUeg Ckkxl/v3gE+T4oZKs=; b=pFdfuW6GN60UiqyALNsUDamKP4TD9t2nQp0Y1GX4jT yBW2miyED3knOav/7xcraLZzeqn3Kwc/l0JMDRVjYOMkm1U3agPtS2KCScUE0/IA gEu0qv7fQeHm4seaOvMPC1zpLzjZcRAnIW2C6YMfb+ZB/OFXL4Fi93IclpJz7wba I= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=j2jtNV OHJ+EdQ5lEDWHDeNtUegCkkxl/v3gE+T4oZKs=; b=NvD4uHuecsF3OtRw5xQ/NT EtImit/BFTTpck64946sEG/PyDAhjlWOQqrIVgk+l74vuiOFA4u8SK3urY1KISTN 0AdaVZULIrxSkxx/ldXzoNEyeEA4e9YaIDXHL0gInP/sAXP6wBo0hadhjEzXa0jJ ulJvmYfg4kLlVLtEfzQrGEMZ2TDQoSo4spBU4n7SkhixusraTzbKcZTQnqA4Klal YlexDmXZL0IaEePmXubeh972KDjqNrw6prL5ukwCQjR2kNwOHxQc3oCvAFsSTwKQ 7uGoPONlrI7uCDbR78Co6N3Gz9Fs8hJdnwMmeC9K/rX3AiggvilLAkcMZaek08WQ == X-ME-Proxy: X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 6FA21E47E1; Wed, 19 Sep 2018 05:41:33 -0400 (EDT) From: Thomas Monjalon To: Gaetan Rivet Cc: dev@dpdk.org, Ferruh Yigit Date: Wed, 19 Sep 2018 11:41:32 +0200 Message-ID: <1561577.FGpAnZtoNE@xps> In-Reply-To: <992ccee1-45c3-08d4-e743-b7490495c1e5@intel.com> References: <20180911150049.14755-1-gaetan.rivet@6wind.com> <992ccee1-45c3-08d4-e743-b7490495c1e5@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v2] eal: add strscpy function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2018 09:41:35 -0000 12/09/2018 15:29, Ferruh Yigit: > On 9/11/2018 4:00 PM, Gaetan Rivet wrote: > > The strncpy function has long been deemed unsafe for use, > > in favor of strlcpy or snprintf. > > > > While snprintf is standard and strlcpy is still largely available, > > they both have issues regarding error checking and performance. > > > > Both will force reading the source buffer past the requested size > > if the input is not a proper c-string, and will return the expected > > number of bytes copied, meaning that error checking needs to verify > > that the number of bytes copied is not superior to the destination > > size. > > > > This contributes to awkward code flow, unclear error checking and > > potential issues with malformed input. > > > > The function strscpy has been discussed for some time already and > > has been made available in the linux kernel[1]. > > > > Propose this new function as a safe alternative. > > > > [1]: http://git.kernel.org/linus/30c44659f4a3 > > > > Signed-off-by: Gaetan Rivet > > Acked-by: Juhamatti Kuusisaari > > Acked-by: Ferruh Yigit Applied, thanks