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

Azarewicz, PiotrX T piotrx.t.azarewicz at intel.com
Mon Apr 4 16:11:52 CEST 2016


Hi Olivier,

> -----Original Message-----
> From: Olivier Matz [mailto:olivier.matz at 6wind.com]
> Sent: Monday, April 4, 2016 10:01 AM
> To: Azarewicz, PiotrX T <piotrx.t.azarewicz at intel.com>
> Cc: dev at dpdk.org
> Subject: Re: [PATCH v1 1/1] cmdline: add any multi string mode to token
> string
> 
> Hi Piotr,
> 
> This is globally ok for me. Please see a comment below.
> 
Good to know it, thanks.

<snip>

> 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];

> 
> Regards,
> Olivier


More information about the dev mailing list