std::strncpy back to strlcpy

This commit is contained in:
d1str4ught
2025-08-22 17:45:31 +02:00
parent 5c9ae80bcd
commit 920a3fc861
59 changed files with 309 additions and 309 deletions

View File

@@ -271,7 +271,7 @@ bool GetIPInfo()
if (!strncmp(netip, "192.168", 7)) // ignore if address is starting with 192
{
std::strncpy(g_szInternalIP, netip, sizeof(g_szInternalIP));
strlcpy(g_szInternalIP, netip, sizeof(g_szInternalIP));
#ifndef OS_WINDOWS
fprintf(stderr, "INTERNAL_IP: %s interface %s\n", netip, ifap->ifa_name);
#else
@@ -280,7 +280,7 @@ bool GetIPInfo()
}
else if (!strncmp(netip, "10.", 3))
{
std::strncpy(g_szInternalIP, netip, sizeof(g_szInternalIP));
strlcpy(g_szInternalIP, netip, sizeof(g_szInternalIP));
#ifndef OS_WINDOWS
fprintf(stderr, "INTERNAL_IP: %s interface %s\n", netip, ifap->ifa_name);
#else
@@ -289,7 +289,7 @@ bool GetIPInfo()
}
else if (g_szPublicIP[0] == '0')
{
std::strncpy(g_szPublicIP, netip, sizeof(g_szPublicIP));
strlcpy(g_szPublicIP, netip, sizeof(g_szPublicIP));
#ifndef OS_WINDOWS
fprintf(stderr, "PUBLIC_IP: %s interface %s\n", netip, ifap->ifa_name);
#else
@@ -317,7 +317,7 @@ bool GetIPInfo()
}
else
{
std::strncpy(g_szPublicIP, g_szInternalIP, sizeof(g_szPublicIP));
strlcpy(g_szPublicIP, g_szInternalIP, sizeof(g_szPublicIP));
fprintf(stderr, "PUBLIC_IP: %s (from INTERNAL_IP)\n", g_szPublicIP);
return true;
}
@@ -570,7 +570,7 @@ void config_init(const string& st_localeServiceName)
TOKEN("db_addr")
{
std::strncpy(db_addr, value_string, sizeof(db_addr));
strlcpy(db_addr, value_string, sizeof(db_addr));
for (int n = 0; n < ADDRESS_MAX_LEN; ++n)
{
@@ -707,7 +707,7 @@ void config_init(const string& st_localeServiceName)
TOKEN("teen_addr")
{
std::strncpy(teen_addr, value_string, sizeof(teen_addr));
strlcpy(teen_addr, value_string, sizeof(teen_addr));
for (int n = 0; n < ADDRESS_MAX_LEN; ++n)
{
@@ -745,7 +745,7 @@ void config_init(const string& st_localeServiceName)
TOKEN("bind_ip")
{
std::strncpy(g_szPublicIP, value_string, sizeof(g_szPublicIP));
strlcpy(g_szPublicIP, value_string, sizeof(g_szPublicIP));
}
TOKEN("view_range")