Make sure the string is null-terminated in memory_get_string.
This commit is contained in:
parent
ec1cdfd12b
commit
6d1067b915
@ -243,13 +243,19 @@ BOOL memory_get_string(struct dbg_process* pcs, void* addr, BOOL in_debuggee,
|
|||||||
if (!addr) return FALSE;
|
if (!addr) return FALSE;
|
||||||
if (in_debuggee)
|
if (in_debuggee)
|
||||||
{
|
{
|
||||||
if (!unicode) return pcs->process_io->read(pcs->handle, addr, buffer, size, &sz);
|
BOOL ret;
|
||||||
|
|
||||||
buffW = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
|
if (!unicode) ret = pcs->process_io->read(pcs->handle, addr, buffer, size, &sz);
|
||||||
pcs->process_io->read(pcs->handle, addr, buffW, size * sizeof(WCHAR), &sz);
|
else
|
||||||
WideCharToMultiByte(CP_ACP, 0, buffW, sz / sizeof(WCHAR), buffer, size,
|
{
|
||||||
NULL, NULL);
|
buffW = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
|
||||||
HeapFree(GetProcessHeap(), 0, buffW);
|
ret = pcs->process_io->read(pcs->handle, addr, buffW, size * sizeof(WCHAR), &sz);
|
||||||
|
WideCharToMultiByte(CP_ACP, 0, buffW, sz / sizeof(WCHAR), buffer, size,
|
||||||
|
NULL, NULL);
|
||||||
|
HeapFree(GetProcessHeap(), 0, buffW);
|
||||||
|
}
|
||||||
|
if (size) buffer[size-1] = 0;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user