[dpdk-dev] [PATCH v1 1/1] cmdline: add any multi string mode to token string

Azarewicz, PiotrX T piotrx.t.azarewicz at intel.com
Tue Apr 5 08:58:11 CEST 2016


Hi Olivier,

> -----Original Message-----
> From: Olivier Matz [mailto:olivier.matz at 6wind.com]
> Sent: Monday, April 4, 2016 5:58 PM
> >> Using token_len + 1 as the buffer size in the snprintf looks a bit
> >> dangerous, as it won't protect from overflows.
> >>
> >> See the following example:
> >  <snip>
> >  > That's why snprintf() should still use STR_TOKEN_SIZE.
> >>
> > Okay, I see it.
> > But this is a problem that we may need longer string than STR_TOKEN_SIZE
> in multi token case.
> > So what you think about adding new typedef cmdline_multi_string_t for
> this case?
> > For example:
> > #define STR_MULTI_TOKEN_SIZE 1024
> > typedef char cmdline_multi_string_t[STR_MULTI_TOKEN_SIZE];
> 
> It should do the job, indeed.

That's great.
We want to set the value of the buffer to 4096, to not to regret in the future.

> By the way, it would be nice to have an example of use.

Based on this we plan a lot of changes in ip_pipeline example next release.

Regards,
Piotr


More information about the dev mailing list