From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 5848E58C4 for ; Wed, 12 Dec 2018 11:19:06 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Dec 2018 02:19:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,344,1539673200"; d="scan'208";a="117705354" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.93]) ([10.237.220.93]) by orsmga002.jf.intel.com with ESMTP; 12 Dec 2018 02:19:04 -0800 To: "Richardson, Bruce" , Jakub Grajciar , "dev@dpdk.org" References: <20181210091457.6031-1-jgrajcia@cisco.com> <20181210100639.30244-1-jgrajcia@cisco.com> <7ebcd985-0d04-c0e1-5411-8e02c8bc72b2@intel.com> <59AF69C657FD0841A61C55336867B5B0726FADC1@IRSMSX103.ger.corp.intel.com> From: "Burakov, Anatoly" Message-ID: <54ae65dd-a51f-baa9-1eb2-ea0b18996c25@intel.com> Date: Wed, 12 Dec 2018 10:19:02 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 In-Reply-To: <59AF69C657FD0841A61C55336867B5B0726FADC1@IRSMSX103.ger.corp.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [RFC v2] /net: memory interface (memif) 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, 12 Dec 2018 10:19:06 -0000 On 10-Dec-18 10:50 AM, Richardson, Bruce wrote: > > >> -----Original Message----- >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Burakov, Anatoly >> Sent: Monday, December 10, 2018 10:43 AM >> To: Jakub Grajciar ; dev@dpdk.org >> Subject: Re: [dpdk-dev] [RFC v2] /net: memory interface (memif) >> >> On 10-Dec-18 10:06 AM, Jakub Grajciar wrote: >>> Signed-off-by: Jakub Grajciar >>> --- >> >> As a general comment, some description/cover letter would have been nice. >> >>> + >>> + memif_msg_disconnect_t *d = &e->msg.disconnect; >>> + >>> + e->msg.type = MEMIF_MSG_TYPE_DISCONNECT; >>> + d->code = err_code; >>> + >>> + if (reason != NULL) { >>> + strncpy((char *)d->string, reason, strlen(reason)); >>> + if (cc->pmd != NULL) { >>> + strncpy(cc->pmd->local_disc_string, reason, >>> + strlen(reason)); >>> + } >> >> I haven't looked at the entire thing, this is just something that caught >> my eye during quick skimming through code. >> >> On the face of it, this looks dangerous - you're setting the destination >> buffer size from source buffer size. What if `d->string` is shorter than >> `reason`? >> > > And strncpy is dangerous - use strlcpy instead. Isn't strscpy the string copy function du jour now? :) > > /Bruce > -- Thanks, Anatoly