From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <thomas@monjalon.net> Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id DB89E255 for <dev@dpdk.org>; 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: <xmx:zRmiW0dyvllRKKnSbksYcTzym7Q-eJjglWA8bQSBqKnBaEq_fkbb3A> <xmx:zRmiWztqqAj9ztZB5W0EhiClb8XZmnuaqKn67PcVdQSX2G2suZqhxg> <xmx:zhmiW739dmW3EwpmODgKaEj90mc1zjth6wasfWUp6lpGJcrHsbTpzw> <xmx:zhmiWxH_zRIx9y3ujQXWQ8O0BQbjZ4cr8ILmECwh6XH1pDYQSJRE7g> <xmx:zhmiW4Md9xNB7ouNutULrcIZ-ZZghJtuoaeNEWYso9pLwW-kn2mS6A> <xmx:zhmiW4VPEd_LT2Q917PmUTuCicTwpX4zQDsBH0QWe64QJLhPmc2wdA> X-ME-Sender: <xms:zRmiW6NbEXRuqyQ_H6slOtZdgYMpRbK4pynYFHl6ydqZfdovj4s9JQ> 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 <thomas@monjalon.net> To: Gaetan Rivet <gaetan.rivet@6wind.com> Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com> 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: <VI1PR0402MB2925CBB67AAE319E808478AC9D040@VI1PR0402MB2925.eurprd04.prod.outlook.com> <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 <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=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 <gaetan.rivet@6wind.com> > > Acked-by: Juhamatti Kuusisaari <juhamatti.kuusisaari@coriant.com> > > Acked-by: Ferruh Yigit <ferruh.yigit@intel.com> Applied, thanks