[dpdk-dev] [PATCH v5 4/5] app/pdump: fix string overflow

2016-06-24 Thread Mcnamara, John
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Reshma Pattan
> Sent: Friday, June 24, 2016 5:36 PM
> To: dev at dpdk.org
> Cc: Pattan, Reshma 
> Subject: [dpdk-dev] [PATCH v5 4/5] app/pdump: fix string overflow
> 
> replaced strncpy with snprintf for safely copying the strings.
> 
> Coverity issue 127351: string overflow
> 
> Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing")
> 
> Signed-off-by: Reshma Pattan 

Acked-by: John McNamara 



[dpdk-dev] [PATCH v5 4/5] app/pdump: fix string overflow

2016-06-24 Thread Reshma Pattan
replaced strncpy with snprintf for safely
copying the strings.

Coverity issue 127351: string overflow

Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing")

Signed-off-by: Reshma Pattan 
---
 app/pdump/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index f8923b9..fe4d38a 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -217,12 +217,12 @@ parse_rxtxdev(const char *key, const char *value, void 
*extra_args)
struct pdump_tuples *pt = extra_args;

if (!strcmp(key, PDUMP_RX_DEV_ARG)) {
-   strncpy(pt->rx_dev, value, strlen(value));
+   snprintf(pt->rx_dev, sizeof(pt->rx_dev), "%s", value);
/* identify the tx stream type for pcap vdev */
if (if_nametoindex(pt->rx_dev))
pt->rx_vdev_stream_type = IFACE;
} else if (!strcmp(key, PDUMP_TX_DEV_ARG)) {
-   strncpy(pt->tx_dev, value, strlen(value));
+   snprintf(pt->tx_dev, sizeof(pt->tx_dev), "%s", value);
/* identify the tx stream type for pcap vdev */
if (if_nametoindex(pt->tx_dev))
pt->tx_vdev_stream_type = IFACE;
-- 
2.5.0