From 9abc3a771af5550e42b916ad397e1e6457f295ba Mon Sep 17 00:00:00 2001 From: Jannik Vogel Date: Fri, 9 Nov 2018 21:15:19 +0100 Subject: [PATCH 1/2] Fix overflow in some objects --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 918ce3e..898e610 100644 --- a/main.c +++ b/main.c @@ -94,7 +94,7 @@ uint32_t tls[1000] = {0}; static void UnknownImport(void* uc, Address address, void* user_data); Address CreateInterface(const char* name, unsigned int slotCount) { //FIXME: Unsure about most terminology / inner workings here - Address interfaceAddress = Allocate(100); //FIXME: Size of object + Address interfaceAddress = Allocate(1000); //FIXME: Size of object Address vtableAddress = Allocate(4 * slotCount); uint32_t* vtable = (uint32_t*)Memory(vtableAddress); for(unsigned int i = 0; i < slotCount; i++) { From e0c6d6a4efb28df13ffd7327e0911c736d655746 Mon Sep 17 00:00:00 2001 From: Jannik Vogel Date: Fri, 9 Nov 2018 21:15:56 +0100 Subject: [PATCH 2/2] Prevent undefined pointers from causing bad memory access --- main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.c b/main.c index 898e610..a669c62 100644 --- a/main.c +++ b/main.c @@ -599,6 +599,9 @@ HACKY_IMPORT_END() HACKY_IMPORT_BEGIN(GetStartupInfoA) hacky_printf("lpStartupInfo 0x%" PRIX32 "\n", stack[1]); + + memset(Memory(stack[1]), 0x00, 68); + esp += 1 * 4; HACKY_IMPORT_END()