Chore: use ffStrCopyN instead of strlcpy

This commit is contained in:
李通洲
2024-10-17 22:29:38 +08:00
parent 9bd692dffb
commit 48bb5b8746
7 changed files with 29 additions and 17 deletions
+2 -2
View File
@@ -231,7 +231,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
FF_LIST_FOR_EACH(FFLocalIpResult, iface, *results)
{
struct ifreq ifr;
strlcpy(ifr.ifr_name, iface->name.chars, IFNAMSIZ);
ffStrCopyN(ifr.ifr_name, iface->name.chars, IFNAMSIZ);
if (options->showType & FF_LOCALIP_TYPE_MTU_BIT)
{
@@ -248,7 +248,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
iface->speed = (edata.speed_hi << 16) | edata.speed; // ethtool_cmd_speed is not available on Android
#elif __FreeBSD__ || __APPLE__ || __OpenBSD__
struct ifmediareq ifmr = {};
strlcpy(ifmr.ifm_name, iface->name.chars, IFNAMSIZ);
ffStrCopyN(ifmr.ifm_name, iface->name.chars, IFNAMSIZ);
if (ioctl(sockfd, SIOCGIFMEDIA, &ifmr) == 0 && (IFM_TYPE(ifmr.ifm_active) & IFM_ETHER))
{
switch (IFM_SUBTYPE(ifmr.ifm_active))