SavedataParam: Be careful with const char* to string. Might help #13187

This commit is contained in:
Henrik Rydgård 2020-08-26 22:17:42 +02:00
parent 3574a352df
commit b652f62d19
2 changed files with 6 additions and 2 deletions

View file

@ -263,7 +263,11 @@ std::string SavedataParam::GetSaveFilePath(const SceUtilitySavedataParam *param,
inline static std::string FixedToString(const char *str, size_t n)
{
return std::string(str, strnlen(str, n));
if (!str) {
return std::string("");
} else {
return std::string(str, strnlen(str, n));
}
}
std::string SavedataParam::GetGameName(const SceUtilitySavedataParam *param) const

View file

@ -155,7 +155,7 @@ int ParamSFOData::GetDataOffset(const u8 *paramsfo, std::string dataName) {
for (u32 i = 0; i < header->index_table_entries; i++)
{
const char *key = (const char *)(key_start + indexTables[i].key_table_offset);
if(std::string(key) == dataName)
if (!strcmp(key, dataName.c_str()))
{
return data_start + indexTables[i].data_table_offset;
}