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 8B9F7A0526; Tue, 10 Nov 2020 10:44:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 359022C52; Tue, 10 Nov 2020 10:44:15 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id 6850F2C52 for ; Tue, 10 Nov 2020 10:44:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605001450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YT2cnJ5l9w1WOEhDt82foShuwFZ2r2dofSCtqlIryq4=; b=PufW0Kqg6cmCq4BNbvF7e+fumcjAg3T2MZ6JiFGW5qaZCOM3ZSX2dHJ0ehylKFRoWVy5Fz n32m5OvNrftirB5yVvmbxUDrEXEMZK+QyPiZT/grcJ+ySHUlHDiobAIYNMgn4q8k+axRMn 7FWiXdrZrwAkyhblQGc0rUR9XDFc+Jc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-532-BoGb-C8cPlmx4vfhFT8QQw-1; Tue, 10 Nov 2020 04:44:08 -0500 X-MC-Unique: BoGb-C8cPlmx4vfhFT8QQw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A4709801AF6; Tue, 10 Nov 2020 09:44:07 +0000 (UTC) Received: from [10.36.110.32] (unknown [10.36.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E80E4149; Tue, 10 Nov 2020 09:44:06 +0000 (UTC) To: Cheng Jiang , chenbo.xia@intel.com Cc: dev@dpdk.org, patrick.fu@intel.com, YvonneX.Yang@intel.com References: <20201106032401.9149-1-Cheng1.jiang@intel.com> From: Maxime Coquelin Message-ID: Date: Tue, 10 Nov 2020 10:44:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201106032401.9149-1-Cheng1.jiang@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v1] examples/vhost: fix missing args length check 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 11/6/20 4:24 AM, Cheng Jiang wrote: > Add args length check before copying to fix the coverity issue. > > Fixes: 3a04ecb21420 ("examples/vhost: add async vhost args parsing") > Coverity issue: 363741 > > Signed-off-by: Cheng Jiang > --- > examples/vhost/main.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/examples/vhost/main.c b/examples/vhost/main.c > index 59a1aff07c..ec88874d16 100644 > --- a/examples/vhost/main.c > +++ b/examples/vhost/main.c > @@ -634,6 +634,12 @@ us_vhost_parse_args(int argc, char **argv) > > if (!strncmp(long_option[option_index].name, > "dma-type", MAX_LONG_OPT_SZ)) { > + if (strlen(optarg) >= MAX_LONG_OPT_SZ) { > + RTE_LOG(INFO, VHOST_CONFIG, > + "Wrong DMA type\n"); > + us_vhost_usage(prgname); > + return -1; > + } > strcpy(dma_type, optarg); > } > > Reviewed-by: Maxime Coquelin Thanks, Maxime