Qt: Fix buffer termination issue

This commit is contained in:
Vicki Pfau 2023-03-06 00:08:41 -08:00
parent a7c232b284
commit 5265573c0c
1 changed files with 2 additions and 1 deletions

View File

@ -16,6 +16,7 @@
#endif
#include <mgba/core/core.h>
#include <mgba-util/string.h>
#include <mgba-util/vfs.h>
using namespace QGBA;
@ -161,7 +162,7 @@ CoreController* CoreManager::loadBIOS(int platform, const QString& path) {
mCoreConfigSetOverrideIntValue(&core->config, "skipBios", 0);
QByteArray bytes(info.baseName().toUtf8());
strncpy(core->dirs.baseName, bytes.constData(), sizeof(core->dirs.baseName));
strlcpy(core->dirs.baseName, bytes.constData(), sizeof(core->dirs.baseName));
bytes = info.dir().canonicalPath().toUtf8();
mDirectorySetAttachBase(&core->dirs, VDirOpen(bytes.constData()));