diff --git a/src/system/kernel/debug/user_debugger.cpp b/src/system/kernel/debug/user_debugger.cpp index 72c305b6c6..156104607e 100644 --- a/src/system/kernel/debug/user_debugger.cpp +++ b/src/system/kernel/debug/user_debugger.cpp @@ -1064,6 +1064,8 @@ write_user_memory(void *_address, const void *_buffer, int32 size, } // restrict this round of writing to the found area + if (toWrite > (int32)areaInfo.size) + toWrite = areaInfo.size; if (address + toWrite > (char*)areaInfo.address + areaInfo.size) toWrite = (char*)areaInfo.address + areaInfo.size - address;