# Re: \[PATCH\] net/ethernet/qlogic/qed: force the string buffer NULL-terminated

- From: David Miller \<davem@davemloft.net\>
- Date: 2019-08-03 00:57:35 
- List: netdev
- Page: https://ratatoskr.run/netdev/2019/08/11143799
- Thread: https://ratatoskr.run/netdev/2019/07/11143500/t.md

```text
From: Wang Xiayang <redacted>
Date: Wed, 31 Jul 2019 16:15:42 +0800

> strncpy() does not ensure NULL-termination when the input string
> size equals to the destination buffer size 30.
> The output string is passed to qed_int_deassertion_aeu_bit()
> which calls DP_INFO() and relies NULL-termination.
> 
> Use strlcpy instead. The other conditional branch above strncpy()
> needs no fix as snprintf() ensures NULL-termination.
> 
> This issue is identified by a Coccinelle script.
> 
> Signed-off-by: Wang Xiayang <redacted>

Applied.
```
