fix race condition allowing attackers to access destination file
authorW. Felix Handte <w@felixhandte.com>
Wed, 6 Oct 2021 07:27:47 +0000 (08:27 +0100)
committerAndreas Tille <tille@debian.org>
Wed, 6 Oct 2021 07:27:47 +0000 (08:27 +0100)
commit8868e5774964d5ab6bdc1f1bbdf4de193080df14
tree9a7a0647870fdb96b08b3ff3b9e4b3f956109b31
parent41d6bb9b5536b90986a76c09a73c426547631da4
fix race condition allowing attackers to access destination file

Origin: upstream
Bug: https://github.com/facebook/zstd/issues/2491
Bug-Debian: https://github.com/facebook/zstd/issues/2491
Applied-Upstream: commit:a774c5797399040af62db21d8a9b9769e005430e
Reviewed-by: Étienne Mollier <etienne.mollier@mailoo.org>
Last-Update: 2021-02-18

This commit addresses https://github.com/facebook/zstd/issues/2491.

Note that a downside of this solution is that it is global: `umask()` affects
all file creation calls in the process. I believe this is safe since
`fileio.c` functions should only ever be used in the zstd binary, and these
are (almost) the only files ever created by zstd, and AIUI they're only
created in a single thread. So we can get away with messing with global state.

Note that this doesn't change the permissions of files created by `dibio.c`.
I'm not sure what those should be...
Last-Update: 2021-02-18
Gbp-Pq: Name 0018-fix-file-permissions-on-compression.patch
programs/fileio.c
programs/util.c
programs/util.h