From ce9073a2ca11805c1e53c057bd3ce9c23bfe8dfc Mon Sep 17 00:00:00 2001 From: Sebastiaan Fernandez Date: Fri, 15 Dec 2023 16:31:53 +0100 Subject: [PATCH] Fix buffer overflow --- src/VM/ConstantInstructions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VM/ConstantInstructions.cpp b/src/VM/ConstantInstructions.cpp index c056edd..619c74a 100644 --- a/src/VM/ConstantInstructions.cpp +++ b/src/VM/ConstantInstructions.cpp @@ -102,7 +102,7 @@ void loadConstant(VMThread* thread, u4 index, JavaHeap* heap) u4 arrId = heap->createArray(AT_CHAR, strlen(utf8String)); Array* charArray = heap->getArray(arrId); - strcpy((char*)charArray->data, utf8String); + memcpy((char*)charArray->data, utf8String, strlen(utf8String)); Variable var = {}; var.type = VariableType_REFERENCE;