Fix possible bug in zero length C string reading

develop
Petr Mrázek 2011-03-28 02:13:32 +02:00
parent cfd309bf70
commit 75b44ba33b
1 changed files with 2 additions and 1 deletions

@ -516,8 +516,9 @@ const std::string NormalProcess::readCString (const uint32_t offset)
{
if(!ReadProcessMemory(my_handle, (int*) (offset + counter), &r, sizeof(uint8_t), NULL)) break;
r = Process::readByte(offset+counter);
if(!r) break;
// order is important. even if the first character is \0, we cound that as a success. It's an empty string.
counter++;
if(!r) break;
temp.append(1,r);
}
if(!counter)