From 75b44ba33b8389dcde8867d6f62719e679a8695f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 28 Mar 2011 02:13:32 +0200 Subject: [PATCH] Fix possible bug in zero length C string reading --- library/DFProcess-windows.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/DFProcess-windows.cpp b/library/DFProcess-windows.cpp index d9f12a52c..56eb19ecc 100644 --- a/library/DFProcess-windows.cpp +++ b/library/DFProcess-windows.cpp @@ -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)