From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Burakov, Anatoly" Subject: Re: [RFC v2] /net: memory interface (memif) Date: Mon, 10 Dec 2018 10:42:51 +0000 Message-ID: <7ebcd985-0d04-c0e1-5411-8e02c8bc72b2@intel.com> References: <20181210091457.6031-1-jgrajcia@cisco.com> <20181210100639.30244-1-jgrajcia@cisco.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit To: Jakub Grajciar , dev@dpdk.org Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 133745F72 for ; Mon, 10 Dec 2018 11:42:53 +0100 (CET) In-Reply-To: <20181210100639.30244-1-jgrajcia@cisco.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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`? -- Thanks, Anatoly