[programs] set chmod 600 after opening destination file
This resolves a race condition where zstd or unzstd may expose read permissions beyond the original file allowed. Mode 600 is used temporarily during the compression and decompression write stage and the new file inherits the original file’s mode at the end. Fixes #1630
This commit is contained in:
parent
d06c15cc89
commit
3968160a91
@ -566,6 +566,7 @@ static FILE* FIO_openDstFile(FIO_prefs_t* const prefs, const char* srcFileName,
|
||||
{ FILE* const f = fopen( dstFileName, "wb" );
|
||||
if (f == NULL)
|
||||
DISPLAYLEVEL(1, "zstd: %s: %s\n", dstFileName, strerror(errno));
|
||||
chmod(dstFileName, 00600);
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user