diff --git a/examples/ZydisPerfTest.c b/examples/ZydisPerfTest.c index 28cdd27..5344fd6 100644 --- a/examples/ZydisPerfTest.c +++ b/examples/ZydisPerfTest.c @@ -360,14 +360,15 @@ int main(int argc, char** argv) { FILE* file; - char buf[256]; - strcpy(&buf[0], directory); + size_t len = strlen(directory); + char buf[1024]; + strncpy(&buf[0], directory, sizeof(buf) - 1); if (generate) { - file = fopen(strcat(buf, tests[i].filename), "wb"); + file = fopen(strncat(buf, tests[i].filename, sizeof(buf) - len - 1), "wb"); } else { - file = fopen(strcat(buf, tests[i].filename), "rb"); + file = fopen(strncat(buf, tests[i].filename, sizeof(buf) - len - 1), "rb"); } if (!file) { diff --git a/src/Decoder.c b/src/Decoder.c index 56603de..2a06434 100644 --- a/src/Decoder.c +++ b/src/Decoder.c @@ -2326,7 +2326,7 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context, (const ZydisInstructionDefinitionEVEX*)definition; // Vector length - uint8_t vectorLength = vectorLength = context->cache.LL;; + uint8_t vectorLength = context->cache.LL; if (def->vectorLength) { vectorLength = def->vectorLength - 1;