mirror of https://github.com/AxioDL/kabufuda.git
Fix -Wstringop-truncation issues
This commit is contained in:
parent
b585305009
commit
106bb02fbf
|
@ -329,10 +329,12 @@ ECardResult Card::renameFile(const char* oldName, const char* newName) {
|
||||||
if (File* replF = dir.getFile(m_game, m_maker, newName)) {
|
if (File* replF = dir.getFile(m_game, m_maker, newName)) {
|
||||||
BlockAllocationTable bat = m_bats[m_currentBat];
|
BlockAllocationTable bat = m_bats[m_currentBat];
|
||||||
_deleteFile(*replF, bat);
|
_deleteFile(*replF, bat);
|
||||||
std::strncpy(f->m_filename, newName, 32);
|
std::memset(f->m_filename, 0, std::size(f->m_filename));
|
||||||
|
std::strncpy(f->m_filename, newName, std::size(m_filename) - 1);
|
||||||
_updateDirAndBat(dir, bat);
|
_updateDirAndBat(dir, bat);
|
||||||
} else {
|
} else {
|
||||||
std::strncpy(f->m_filename, newName, 32);
|
std::memset(f->m_filename, 0, std::size(f->m_filename));
|
||||||
|
std::strncpy(f->m_filename, newName, std::size(m_filename) - 1);
|
||||||
_updateDirAndBat(dir, m_bats[m_currentBat]);
|
_updateDirAndBat(dir, m_bats[m_currentBat]);
|
||||||
}
|
}
|
||||||
return ECardResult::READY;
|
return ECardResult::READY;
|
||||||
|
|
|
@ -13,7 +13,7 @@ File::File(const RawData& rawData) : raw{rawData} {}
|
||||||
File::File(const char* filename) {
|
File::File(const char* filename) {
|
||||||
raw.fill(0);
|
raw.fill(0);
|
||||||
std::memset(m_filename, 0, std::size(m_filename));
|
std::memset(m_filename, 0, std::size(m_filename));
|
||||||
std::strncpy(m_filename, filename, std::size(m_filename));
|
std::strncpy(m_filename, filename, std::size(m_filename) - 1);
|
||||||
}
|
}
|
||||||
void File::swapEndian() {
|
void File::swapEndian() {
|
||||||
m_modifiedTime = SBig(m_modifiedTime);
|
m_modifiedTime = SBig(m_modifiedTime);
|
||||||
|
|
Loading…
Reference in New Issue