[dpdk-dev] [PATCH] app/procinfo: fix strncpy count issue

Bruce Richardson bruce.richardson at intel.com
Tue Feb 20 14:29:14 CET 2018


On Tue, Feb 20, 2018 at 12:57:36PM +0000, Radu Nicolau wrote:
> Change strncpy count parameter to MAX_LONG_OPT_SZ-1 to avoid
> overwriting the last NULL character and for consistency.
> 
> Fixes: 2deb6b5246d7 ("app/procinfo: add collectd format and host id")
> Coverity issue: 30688
> 
> Cc: stable at dpdk.org
> 
> Signed-off-by: Radu Nicolau <radu.nicolau at intel.com>
> ---
strncpy is a very nasty function that is easy to get wrong. Rather than
fixing it's off by one errors, I think a better fix is to use snprintf
as is done in most other places.

/Bruce


More information about the dev mailing list