summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2020-04-28 14:28:30 +0200
committerGitHub <noreply@github.com>2020-04-28 14:28:30 +0200
commit93abbc66aa341bec0b3eb97b121c4b94d29ab2b1 (patch)
tree9cb224a47fcdc5de5b30edafa682e6c0f63a87a4 /Source/Core
parent73907670089f58a6fd43bb4eb8ab537d7b697d84 (diff)
parent7885fdb1ae7002f7c25a35bfc670b3f2b470d203 (diff)
Merge pull request #8688 from howard0su/cleanup_strncpy
Remove warning of -Wstringop-truncation
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/EXI/BBA-TAP/TAP_Unix.cpp2
-rw-r--r--Source/Core/Core/IOS/IOSC.cpp4
-rw-r--r--Source/Core/Core/State.cpp4
3 files changed, 5 insertions, 5 deletions
diff --git a/Source/Core/Core/HW/EXI/BBA-TAP/TAP_Unix.cpp b/Source/Core/Core/HW/EXI/BBA-TAP/TAP_Unix.cpp
index 05505af9db..f13db04b65 100644
--- a/Source/Core/Core/HW/EXI/BBA-TAP/TAP_Unix.cpp
+++ b/Source/Core/Core/HW/EXI/BBA-TAP/TAP_Unix.cpp
@@ -50,7 +50,7 @@ bool CEXIETHERNET::Activate()
const int MAX_INTERFACES = 32;
for (int i = 0; i < MAX_INTERFACES; ++i)
{
- strncpy(ifr.ifr_name, StringFromFormat("Dolphin%d", i).c_str(), IFNAMSIZ);
+ strncpy(ifr.ifr_name, StringFromFormat("Dolphin%d", i).c_str(), IFNAMSIZ - 1);
int err;
if ((err = ioctl(fd, TUNSETIFF, (void*)&ifr)) < 0)
diff --git a/Source/Core/Core/IOS/IOSC.cpp b/Source/Core/Core/IOS/IOSC.cpp
index 94159e1ce7..9b70e70e95 100644
--- a/Source/Core/Core/IOS/IOSC.cpp
+++ b/Source/Core/Core/IOS/IOSC.cpp
@@ -420,9 +420,9 @@ static CertECC MakeBlankEccCert(const std::string& issuer, const std::string& na
{
CertECC cert{};
cert.signature.type = SignatureType(Common::swap32(u32(SignatureType::ECC)));
- std::strncpy(cert.signature.issuer, issuer.c_str(), 0x40);
+ issuer.copy(cert.signature.issuer, sizeof(cert.signature.issuer) - 1);
cert.header.public_key_type = PublicKeyType(Common::swap32(u32(PublicKeyType::ECC)));
- std::strncpy(cert.header.name, name.c_str(), 0x40);
+ name.copy(cert.header.name, sizeof(cert.header.name) - 1);
cert.header.id = Common::swap32(key_id);
cert.public_key = Common::ec::PrivToPub(private_key);
return cert;
diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp
index db97cea52b..c8bc970315 100644
--- a/Source/Core/Core/State.cpp
+++ b/Source/Core/Core/State.cpp
@@ -341,8 +341,8 @@ static void CompressAndDumpState(CompressAndDumpState_args save_args)
}
// Setting up the header
- StateHeader header;
- strncpy(header.gameID, SConfig::GetInstance().GetGameID().c_str(), 6);
+ StateHeader header{};
+ SConfig::GetInstance().GetGameID().copy(header.gameID, std::size(header.gameID));
header.size = g_use_compression ? (u32)buffer_size : 0;
header.time = Common::Timer::GetDoubleTime();