fix: replace strncpy with memcpy and increase error message buffer size

Replace strncpy with memcpy in readBuiltInModule to avoid potential string termination issues
when copying module source code, and increase ERROR_MESSAGE_SIZE from 60 to 80 to provide
more room for compiler error messages with long variable names.
This commit is contained in:
Bob Nystrom
2018-04-28 23:38:09 +00:00
parent c3aad8049e
commit be6c17558d
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -241,7 +241,7 @@ char* readBuiltInModule(const char* name)
size_t length = strlen(*module->source);
char* copy = (char*)malloc(length + 1);
strncpy(copy, *module->source, length + 1);
memcpy(copy, *module->source, length + 1);
return copy;
}