[dpdk-dev] [PATCH] string: fix potential seg fault on snprintf
Richardson, Bruce
bruce.richardson at intel.com
Fri Jun 27 18:36:12 CEST 2014
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Olivier MATZ
> Sent: Friday, June 27, 2014 5:34 AM
> To: De Lara Guarch, Pablo; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] string: fix potential seg fault on snprintf
>
> Hi Pablo,
>
> On 06/27/2014 02:13 PM, De Lara Guarch, Pablo wrote:
> > 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.
>
> Indeed I missed the unit test, thanks.
>
> I think that testing the NULL case is not required. To me, it is like
> testing snprintf(NULL, ...)
>
Famous last words include "that could never happen!" :-)
Since this is not a performance critical piece of code, it does not hurt to leave the Null-check in, and get the additional safety of checking for invalid inputs.
More information about the dev
mailing list