[dpdk-dev] [PATCH] trace: fix build with gcc 10

Phil Yang Phil.Yang at arm.com
Tue Apr 28 09:15:40 CEST 2020


> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: Tuesday, April 28, 2020 12:59 AM
> To: Phil Yang <Phil.Yang at arm.com>
> Cc: jerinj at marvell.com; skori at marvell.com; dev at dpdk.org;
> david.marchand at redhat.com; Lijian Zhang <Lijian.Zhang at arm.com>;
> Ruifeng Wang <Ruifeng.Wang at arm.com>; nd <nd at arm.com>
> Subject: Re: [dpdk-dev] [PATCH] trace: fix build with gcc 10
> 
> On Tue, 28 Apr 2020 00:47:38 +0800
> Phil Yang <phil.yang at arm.com> wrote:
> 
> > -	if (strlen(optarg) >= size) {
> > +	/* the specified trace directory name cannot
> > +	 * exceed PATH_MAX-1.
> > +	 */
> > +	if (strlen(optarg) >= (size - 1)) {
> >  		trace_err("input string is too big");
> 
> strnlen() is useful for these kinds of cases.

Thanks, Stephen.
I think it checks the dir_name length here, not to trim the input 'optarg'.
So I think the strlen() can handle it correctly.

Thanks,
Phil 


More information about the dev mailing list