> -----Original Message----- > From: Stephen Hemminger <[email protected]> > Sent: Tuesday, April 28, 2020 12:59 AM > To: Phil Yang <[email protected]> > Cc: [email protected]; [email protected]; [email protected]; > [email protected]; Lijian Zhang <[email protected]>; > Ruifeng Wang <[email protected]>; nd <[email protected]> > Subject: Re: [dpdk-dev] [PATCH] trace: fix build with gcc 10 > > On Tue, 28 Apr 2020 00:47:38 +0800 > Phil Yang <[email protected]> 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

