From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 112C76D45; Fri, 22 Sep 2017 15:07:42 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Sep 2017 06:07:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,427,1500966000"; d="scan'208";a="1222367712" Received: from unknown ([10.103.102.61]) by fmsmga002.fm.intel.com with SMTP; 22 Sep 2017 06:07:36 -0700 Received: by (sSMTP sendmail emulation); Fri, 22 Sep 2017 15:07:36 +0200 From: Michal Jastrzebski To: yliu@fridaylinux.org, maxime.coquelin@redhat.com Cc: dev@dpdk.org, deepak.k.jain@intel.com, Jacek Piasecki , changpeng.liu@intel.com, stable@dpdk.org Date: Fri, 22 Sep 2017 15:07:34 +0200 Message-Id: <20170922130734.7256-1-michalx.k.jastrzebski@intel.com> X-Mailer: git-send-email 2.12.2 Subject: [dpdk-stable] [PATCH] examples/vhost_scsi: fix buffer not terminated X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Sep 2017 13:07:43 -0000 From: Jacek Piasecki Fix size of buffer in strcpy. There was possible to get not terminated string after copy operation. Coverity issue: 158631 Fixes: db75c7af19bb ("examples/vhost_scsi: introduce a new sample app") Cc: changpeng.liu@intel.com Cc: stable@dpdk.org Signed-off-by: Jacek Piasecki --- examples/vhost_scsi/scsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/vhost_scsi/scsi.c b/examples/vhost_scsi/scsi.c index 54d3104..de9639a 100644 --- a/examples/vhost_scsi/scsi.c +++ b/examples/vhost_scsi/scsi.c @@ -307,7 +307,8 @@ strncpy((char *)inqdata->t10_vendor_id, "INTEL", 8); /* PRODUCT IDENTIFICATION */ - strncpy((char *)inqdata->product_id, bdev->product_name, 16); + strncpy((char *)inqdata->product_id, bdev->product_name, + ARRAY_SIZE(inqdata->product_id) - 1); /* PRODUCT REVISION LEVEL */ strncpy((char *)inqdata->product_rev, "0001", 4); -- 1.9.1