Hi Piotr, On 04/04/2016 04:11 PM, Azarewicz, PiotrX T wrote: >> 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. By the way, it would be nice to have an example of use. Regards, Olivier