From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 95C59A00C5; Fri, 8 May 2020 10:51:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C6EFE1DB3A; Fri, 8 May 2020 10:51:20 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 8D2021DB33 for ; Fri, 8 May 2020 10:51:18 +0200 (CEST) IronPort-SDR: 8/oS2/phjMDZCpnSiKInEGuwW2Bg/KKPuDs+BkVyYxTkFIuaVHBGVOH6oslh1wsw0/5b6njKPh ezu7gEsb65nA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2020 01:51:17 -0700 IronPort-SDR: uuyGRD33fZC8Exc0W6DXpYKYEk2AAW/gVZ9bUFz60SrrZJYfFYwcGer1tLUbpmPdV+ugoCx5DH UI2yRn5uNJIA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,367,1583222400"; d="scan'208";a="462154392" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.116.183]) by fmsmga005.fm.intel.com with ESMTP; 08 May 2020 01:51:16 -0700 Date: Fri, 8 May 2020 16:43:25 +0800 From: Ye Xiaolong To: Jin Yu Cc: Maxime Coquelin , Zhihong Wang , dev@dpdk.org Message-ID: <20200508084325.GF75514@intel.com> References: <20200508130254.39929-1-jin.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200508130254.39929-1-jin.yu@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH] example/vhost_blk: fix buffer not null terminated 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 05/08, Jin Yu wrote: >Fix the potential bug. Could you describe more about the potential bug? Fixes tag is needed here. Thanks, Xiaolong > >Signed-off-by: Jin Yu >--- > examples/vhost_blk/vhost_blk.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > >diff --git a/examples/vhost_blk/vhost_blk.c b/examples/vhost_blk/vhost_blk.c >index f08473f58..b5ce3332a 100644 >--- a/examples/vhost_blk/vhost_blk.c >+++ b/examples/vhost_blk/vhost_blk.c >@@ -757,8 +757,9 @@ vhost_blk_bdev_construct(const char *bdev_name, > if (!bdev) > return NULL; > >- strncpy(bdev->name, bdev_name, sizeof(bdev->name)); >- strncpy(bdev->product_name, bdev_serial, sizeof(bdev->product_name)); >+ snprintf(bdev->name, sizeof(bdev->name), "%s", bdev_name); >+ snprintf(bdev->product_name, sizeof(bdev->product_name), "%s", >+ bdev_serial); > bdev->blocklen = blk_size; > bdev->blockcnt = blk_cnt; > bdev->write_cache = wce_enable; >-- >2.17.2 >