On Wed, Oct 07, 2020 at 11:51:31AM +0200, Olivier Matz wrote: > On Wed, Oct 07, 2020 at 10:40:32AM +0100, Ferruh Yigit wrote: > > On 10/7/2020 10:01 AM, Ciara Loftus wrote: > > > strncpy may leave the destination buffer not NULL terminated so use > > > snprintf instead. > > > > What do you think using 'strlcpy'? > > Or even better, rte_strscpy() > https://git.dpdk.org/dpdk/commit/?id=b0236c7cf761 > I think this is largely a matter of preference, and unless there is a good reason not to, I tend towards strlcpy as the older and more common (till now) interface. The main thing is just to use a function that will guarantee dest is null-terminated here, and both strlcpy and strscpy meet that criteria.
/Bruce