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:
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user