[dpdk-dev] [PATCH 3/3] app/pdump: fix string overflow

2016-06-22 Thread Anupam Kapoor
> if (!strcmp(key, PDUMP_RX_DEV_ARG)) { > - strncpy(pt->rx_dev, value, strlen(value)); > + strncpy(pt->rx_dev, value, sizeof(pt->rx_dev)-1); I guess size-1 is to give room for terminating null byte, but for this case is it guarantied that pt->rx_dev last byte is

[dpdk-dev] [PATCH 3/3] app/pdump: fix string overflow

2016-06-22 Thread Bruce Richardson
On Wed, Jun 22, 2016 at 12:16:27PM +0530, Anupam Kapoor wrote: > > if (!strcmp(key, PDUMP_RX_DEV_ARG)) { > > - strncpy(pt->rx_dev, value, strlen(value)); > > + strncpy(pt->rx_dev, value, sizeof(pt->rx_dev)-1); > > I guess size-1 is to give room for terminating null

[dpdk-dev] [PATCH 3/3] app/pdump: fix string overflow

2016-06-22 Thread Pattan, Reshma
Hi, > -Original Message- > From: Richardson, Bruce > Sent: Wednesday, June 22, 2016 10:22 AM > To: Anupam Kapoor > Cc: Yigit, Ferruh ; Pattan, Reshma > ; dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH 3/3] app/pdump: fix string overflow > > On Wed, Jun 2

[dpdk-dev] [PATCH 3/3] app/pdump: fix string overflow

2016-06-21 Thread Ferruh Yigit
On 6/21/2016 4:18 PM, Reshma Pattan wrote: > using source length in strncpy can cause destination > overflow if destination length is not big enough to > handle the source string. Changes are made to use destination > size instead of source length in strncpy. > > Coverity issue 127351: string

[dpdk-dev] [PATCH 3/3] app/pdump: fix string overflow

2016-06-21 Thread Reshma Pattan
using source length in strncpy can cause destination overflow if destination length is not big enough to handle the source string. Changes are made to use destination size instead of source length in strncpy. Coverity issue 127351: string overflow Fixes: caa7028276b8 ("app/pdump: add tool for