[OSX] Fix "SIGILL: illegal instruction" on macOS Catalina
on OSX, strncpy may copy to overlapping (protected) memory. this sometimes happens when loading WAD files. This patch eliminates these problems for me
This commit is contained in:
1 parent
a772096757
commit
1bfcec9242
1 file changed
+4
-1
+4
-1
@@ -150,7 +150,10 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
|
||||
{
|
||||
FILE *handle;
|
||||
|
||||
strncpy(filenamebuf, *filename, MAX_WADPATH);
|
||||
if (filenamebuf != *filename) {
|
||||
// avoid overlap
|
||||
strncpy(filenamebuf, *filename, MAX_WADPATH);
|
||||
}
|
||||
filenamebuf[MAX_WADPATH - 1] = '\0';
|
||||
*filename = filenamebuf;
|
||||
|
||||
|
||||
Reference in new issue
Block a user