Re: [PATCH v2 5/5] checkpatch: Add warnings for using strn(cat|cpy)

2021-04-13 Thread Tom Rini
On Thu, Mar 11, 2021 at 12:15:45AM -0500, Sean Anderson wrote: > strn(cat|cpy) has a bad habit of not nul-terminating the destination, > resulting in constructions like > > strncpy(foo, bar, sizeof(foo) - 1); > foo[sizeof(foo) - 1] = '\0'; > > However, it is very easy to forget about

Re: [PATCH v2 5/5] checkpatch: Add warnings for using strn(cat|cpy)

2021-03-24 Thread Simon Glass
On Thu, 11 Mar 2021 at 18:16, Sean Anderson wrote: > > strn(cat|cpy) has a bad habit of not nul-terminating the destination, > resulting in constructions like > > strncpy(foo, bar, sizeof(foo) - 1); > foo[sizeof(foo) - 1] = '\0'; > > However, it is very easy to forget about this be