> -----Original Message-----
> From: Stephen Hemminger <step...@networkplumber.org>
> Sent: Tuesday, April 28, 2020 12:59 AM
> To: Phil Yang <phil.y...@arm.com>
> Cc: jer...@marvell.com; sk...@marvell.com; dev@dpdk.org;
> david.march...@redhat.com; Lijian Zhang <lijian.zh...@arm.com>;
> Ruifeng Wang <ruifeng.w...@arm.com>; nd <n...@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.y...@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 

Reply via email to