[dpdk-dev] [PATCH] string: fix potential seg fault on snprintf

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Fri Jun 27 14:13:24 CEST 2014


Hi Olivier

> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Olivier MATZ
> Sent: Friday, June 27, 2014 12:30 PM
> To: De Lara Guarch, Pablo; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] string: fix potential seg fault on snprintf
> 
> Hello Pablo,
> 
> On 06/27/2014 01:04 PM, Pablo de Lara wrote:
> > From: Pablo de Lara <pablo.de.lara.guarch at intel.com>
> >
> > Several functions did not check if destination buffer, used
> > in snprintf was a non-NULL pointer.
> 
> Did you noticed any issue without this patch?

With last Thomas' patch, cmdline unit test does not pass due to this problem (basically it tests this situation).
After test passed, by fixing this issue in several functions, I looked for other places where this happened.

> It seems that all the get_help() cmdline functions are never called
> with a NULL destination buffer (see in cmdline_parse.c). I think it
> is useless to add this test as there is no good reason to give a NULL
> argument. It is like testing that the arguments of strcpy() are
> non-NULL.
> 
> I would say the same for pci_get_uio_dev().
> 

So, if people prefer to discard this patch, then we should modify the cmdline unit test , 
or we could just include the test only in the places needed for the unit test 
(so, remove it in pci_get_uio_dev, for instance).

Regards,
Pablo


More information about the dev mailing list