Be a little more conservative with some string operations.

This should hopefully fix #531, though in practice the previous code
should have been safe too.
This commit is contained in:
Bob Nystrom
2018-04-28 16:38:09 -07:00
parent 41a56446c6
commit c4ae0f5c59
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;
}