Replace strncpy with strlcpy

Since destination size equals number of characters to copy.
Pointed out by gcc8. [-Werror=stringop-truncation]

Change-Id: I8f2118129ec2324bb1f93857f5abfdf121c864f0
Reviewed-on: https://review.haiku-os.org/450
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Skipp_OSX <jscipione@gmail.com>
This commit is contained in:
Murai Takashi 2018-08-08 20:02:04 +09:00 committed by waddlesplash
parent b8761dc31c
commit 00cbe4ccca

View File

@ -207,7 +207,7 @@ BNetworkRoster::GetNextPersistentNetwork(uint32* cookie,
return B_ERROR; return B_ERROR;
memset(network.name, 0, sizeof(network.name)); memset(network.name, 0, sizeof(network.name));
strncpy(network.name, networkName.String(), sizeof(network.name)); strlcpy(network.name, networkName.String(), sizeof(network.name));
BNetworkAddress address; BNetworkAddress address;
if (networkMessage.FindFlat("address", &network.address) != B_OK) if (networkMessage.FindFlat("address", &network.address) != B_OK)