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 076FE454DE; Sun, 23 Jun 2024 22:09:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E9D4402AB; Sun, 23 Jun 2024 22:09:49 +0200 (CEST) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mails.dpdk.org (Postfix) with ESMTP id 6F3D9402A8 for ; Sun, 23 Jun 2024 22:09:48 +0200 (CEST) Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4217926991fso32235395e9.3 for ; Sun, 23 Jun 2024 13:09:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719173388; x=1719778188; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=gSpUdwbZkRYvnJ9zZXacau+QiCfNuklNexx4gFOZKN4=; b=JTTLmatG5R49UeY7y4/Ef2ZJ/tX2hZopOoy529KxhvHGpirIx25OzJdyLrcnuTBprQ /prt+7z7z6dVBoM/sRylAtImWs0cRHmf8khb89WISI3ldxVEMyNHE3/FYoXaDV4vWRqU dDGGdmdWKK2JWFEJky/ncK85qSqnrraXCKZNzWWcdhzYTiLKkF2k/f+1rD0jacYN8kfA h45pyr2pA0c3hNzgZXWxhwOtg8ltZLj9UTkHxEfCVqj6NaleTkE/LcxR4yoOjAOuA6vv 62tgWCDu/Gsy3xnPdm6nB+OPS1v9uicTPqaB3mpax+PMOWb8qNEiUp46jsI/+qzevai7 4e6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719173388; x=1719778188; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gSpUdwbZkRYvnJ9zZXacau+QiCfNuklNexx4gFOZKN4=; b=RMwcKuFo8aLMbjgVTd43KaevZGrnmzR/1/15eD3KcfQraMlrVGmI3M1gbs9VQwqOwg l40zo5CExy2/TMTH1UWN14NCWGFKDm0ffb+3xtSbiSYq++vCr/sAV8egf8bVNPlDRukV f9JS4kESldQX5RRInxPIjTwgDPIL/hKQLse/2XvaL696ZHW8NrhYJJIG91Y1NL8ICCQv r/U/GnXxAxuyK36VedjhPE4T/ea+Cnqcmc/HumFGKlxEyNm3nGvJ0WN3gcLj+zZbO2vT p5me0NxlU8089LjggHHYlXFqXvYnxtVNWFpSXP9P/oS642v375DNP/aLQ81X6pYohm21 zs4w== X-Gm-Message-State: AOJu0YxBgn9OeQbwUCLHhmBb1q12K5TazjYID7nj7MbJdC8G/cTeJ+lt Pp4EFYzKrTo8RgUg3ZsmLTRcDyfPTvjuhpYofQ7MsvnSXE7xRgZU X-Google-Smtp-Source: AGHT+IE/1iT7Hz99aFBinmOIoo6mDo5efSDDBAV6jv51hhVx13FigNMOqzRha8ES8ZmqL+UTg+2UZQ== X-Received: by 2002:a05:600c:4487:b0:424:781a:189f with SMTP id 5b1f17b1804b1-4248b959264mr20677175e9.15.1719173387258; Sun, 23 Jun 2024 13:09:47 -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-4247d0c54e4sm151881305e9.23.2024.06.23.13.09.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jun 2024 13:09:46 -0700 (PDT) From: Mahmoud Maatuq To: Sunil Kumar Kori , Rakesh Kudurumalla , Jerin Jacob , Nithin Dabilpuram Cc: dev@dpdk.org, Mahmoud Maatuq Subject: [PATCH] app/graph: fix destination buffer too small Date: Mon, 24 Jun 2024 00:09:21 +0400 Message-ID: <20240623200921.1715890-1-mahmoudmatook.mm@gmail.com> X-Mailer: git-send-email 2.43.0 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), it's safer to copy min size of them to avoide out of bound memory write. Coverity issue: 415430 Fixes: 3850cb06ab9c ("app/graph: add ethdev commands") Cc: skori@marvell.com Signed-off-by: Mahmoud Maatuq --- 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..4b6009ee12 100644 --- a/app/graph/ethdev.c +++ b/app/graph/ethdev.c @@ -671,7 +671,8 @@ 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)); + memcpy(config.rx.mempool_name, res->mempool, + RTE_MIN(sizeof(config.rx.mempool_name), strlen(res->mempool))); config.tx.n_queues = res->nb_txq; config.tx.queue_size = ETHDEV_TX_DESC_DEFAULT; -- 2.43.0