From 3835d5de43726f7d896943ef3eba6f1028000383 Mon Sep 17 00:00:00 2001 From: sjanusz-r7 Date: Fri, 1 Dec 2023 18:38:14 +0000 Subject: [PATCH] Fix last byte in returned match buffer being cut off --- .../source/extensions/stdapi/server/sys/process/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/meterpreter/source/extensions/stdapi/server/sys/process/memory.c b/c/meterpreter/source/extensions/stdapi/server/sys/process/memory.c index 2b167db3b..a710248b7 100644 --- a/c/meterpreter/source/extensions/stdapi/server/sys/process/memory.c +++ b/c/meterpreter/source/extensions/stdapi/server/sys/process/memory.c @@ -655,7 +655,7 @@ DWORD request_sys_process_memory_search(Remote* remote, Packet* packet) const size_t current_match_length = min(max_match_length, match_length); // Note: This raw data needs to be read from the buffer we copied. Trying to read it from mem.BaseAddress directly will make us crash. - met_api->packet.add_tlv_raw(search_results, TLV_TYPE_MEMORY_SEARCH_MATCH_STR, buffer + current_buffer_offset + result, (DWORD)current_match_length); + met_api->packet.add_tlv_raw(search_results, TLV_TYPE_MEMORY_SEARCH_MATCH_STR, buffer + current_buffer_offset + result, (DWORD)current_match_length + 1); dprintf("[MEM SEARCH] Adding Match address"); met_api->packet.add_tlv_qword(search_results, TLV_TYPE_MEMORY_SEARCH_MATCH_ADDR, match_address);