# Re: \[PATCH v7 1/4\] fs: unicode: Use strscpy() instead of strncpy()

- From: Eric Biggers \<ebiggers@kernel.org\>
- Date: 2021-04-08 00:52:37 
- List: linux-ext4
- Page: https://ratatoskr.run/linux-ext4/2021/04/203466
- Thread: https://ratatoskr.run/linux-ext4/2021/04/203414/t.md

```text
On Wed, Apr 07, 2021 at 08:18:42PM +0530, Shreeya Patel wrote:
> The -Wstringop-truncation warning highlights the unintended
> uses of the strncpy function that truncate the terminating NULL
> character from the source string.
> Unlike strncpy(), strscpy() always null-terminates the destination string,
> hence use strscpy() instead of strncpy().

This explanation is a bit misleading.  It would be clearer to phrase this in
terms of fixing how overly-long strings are handled: start returning an error
instead of creating a non-null-terminated string.

> 
> Fixes: 9d53690f0d4e5 (unicode: implement higher level API for string handling)

There should be quotes around the commit title here.

- Eric
```
