1
0
Fork 0

Format strings at the end of a page correctly

This commit is contained in:
Duncan Ogilvie 2022-08-23 20:39:27 +02:00
parent 117dd32a06
commit 6ecc4bcaa3
1 changed files with 3 additions and 1 deletions

View File

@ -72,11 +72,13 @@ static FORMATRESULT memoryFormatter(char* dest, size_t destCount, int argc, char
return FORMAT_ERROR_MESSAGE;
}
std::vector<Char> data(size);
if(!MemRead(addr, data.data(), size * sizeof(Char)))
duint read = 0;
if(!MemRead(addr, data.data(), size * sizeof(Char), &read) && read == 0)
{
strcpy_s(dest, destCount, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Failed to read memory...")));
return FORMAT_ERROR_MESSAGE;
}
data.resize(read);
auto result = format(data);
if(result.size() > destCount)
return FORMAT_BUFFER_TOO_SMALL;