From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A7629454E3; Mon, 24 Jun 2024 22:01:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D45240A82; Mon, 24 Jun 2024 22:01:31 +0200 (CEST) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mails.dpdk.org (Postfix) with ESMTP id 6562640A76 for ; Mon, 24 Jun 2024 22:01:30 +0200 (CEST) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4218180a122so36282825e9.1 for ; Mon, 24 Jun 2024 13:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719259290; x=1719864090; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ePY1orsmV7nOLiprepKmC+HGnEtIgMHzAkv9MNyiafI=; b=hgf3Ja2WWREslV0dKPw8BxMZRzLeTYoOyLaEOpu4xvZi/rh5gDXNxwn1xFLoKHO4a0 SkTbUNN1opW+DTvEuHIwva4mFRxsjvpVm6q2qLdkTAahpl82oW+N0yflPFX5Fmnmng1d QHAcY6frfI0NP8JF3NJkG5L8LjhyVmRAQcr620wwepeHcjINtDscPZWI3FnOS/3xncOL ZO1mVHF267K0M1Nfhsh6bYd6Xq4Khf6FmZIDUd0i4lVLBp028bv3axUVJWAwLoj41egc b62QtOt59/6EcJbJVs65wgBizAwRPl3iYjVx5CEtAT60ZZRTMgWo5QavIp3PGgV1qW4G lIYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719259290; x=1719864090; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ePY1orsmV7nOLiprepKmC+HGnEtIgMHzAkv9MNyiafI=; b=kbGnmcCMRmrj2iPVvO0F34XoBX3Rwiw2PXyYB+USotx2JXCaS4Fn4DRGQAyZNi7CV0 hnOcbPnDH/c7OHbFYLTrsCUBpyyHzLc9G10WSyrRcYUe0grm3dKEK35Ug9lgpL839PfH rFNn5ensylIlmgTNayNFDrwpNWf992BmxEsUOWJUMh4OK1dvIa54zOU9i8e/jsN2LA2w J6Vw3v4uEPdlmHwcnAR625TZR4uO8xm5rjBF//rdHweJtqLwLFifVMifQj9V+RQT9vir G9xXKoPxlLsZJMNiqhalkWTZ0aTKkP/P1gcjuO/8WpLQwlsLaxKKaQO0km188f5Qnjqh xxmg== X-Gm-Message-State: AOJu0YyX/Po8MQHsvUAdLsaYSaZ+ym00doX5FRkOlA42EdLjoyp/HuSw jxvZCPdtQCrJqW41/DEabyN1jCVya5FkSYxdhIvnUSnsmqxplTMZ X-Google-Smtp-Source: AGHT+IFCndScFJgBUi0jVpJ1r1vbhx5d+iIhaytUNmsT9qIyuTkDjHK3+wBkDAAjgNgnv83x619itA== X-Received: by 2002:a05:600c:68d0:b0:422:77d0:a3d5 with SMTP id 5b1f17b1804b1-4248cc669bfmr46232065e9.36.1719259289439; Mon, 24 Jun 2024 13:01:29 -0700 (PDT) Received: from localhost.localdomain.xyz (bba-2-50-153-93.alshamil.net.ae. [2.50.153.93]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-424817a9667sm143939585e9.15.2024.06.24.13.01.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 13:01:29 -0700 (PDT) From: Mahmoud Maatuq To: Sunil Kumar Kori , Rakesh Kudurumalla , Nithin Dabilpuram , Jerin Jacob Cc: dev@dpdk.org, Mahmoud Maatuq Subject: [PATCH v2] app/graph: fix destination buffer too small Date: Tue, 25 Jun 2024 00:01:14 +0400 Message-ID: <20240624200114.1792214-1-mahmoudmatook.mm@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240623200921.1715890-1-mahmoudmatook.mm@gmail.com> References: <20240623200921.1715890-1-mahmoudmatook.mm@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org as sizeof(config.rx.mempool_name) is < sizeof(res->mempool) we should copy at most sizeof(config.rx.mempool_name) and replace memcpy with strlcpy as mempool name is a null terminated string Coverity issue: 415430 Fixes: 3850cb06ab9c ("app/graph: add ethdev commands") Cc: skori@marvell.com Signed-off-by: Mahmoud Maatuq --- v2: * replaced memcpy with strlcpy --- app/graph/ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/graph/ethdev.c b/app/graph/ethdev.c index cfc1b18569..e7a02b40a9 100644 --- a/app/graph/ethdev.c +++ b/app/graph/ethdev.c @@ -16,6 +16,7 @@ #include "ethdev_priv.h" #include "module_api.h" +#include "rte_string_fns.h" static const char cmd_ethdev_mtu_help[] = "ethdev mtu "; @@ -671,7 +672,7 @@ cmd_ethdev_parsed(void *parsed_result, __rte_unused struct cmdline *cl, void *da memset(&config, 0, sizeof(struct ethdev_config)); config.rx.n_queues = res->nb_rxq; config.rx.queue_size = ETHDEV_RX_DESC_DEFAULT; - memcpy(config.rx.mempool_name, res->mempool, strlen(res->mempool)); + strlcpy(config.rx.mempool_name, res->mempool, sizeof(config.rx.mempool_name)); config.tx.n_queues = res->nb_txq; config.tx.queue_size = ETHDEV_TX_DESC_DEFAULT; -- 2.43.0