fix race condition allowing attackers to access destination file
authorW. Felix Handte <w@felixhandte.com>
Fri, 7 May 2021 07:36:26 +0000 (08:36 +0100)
committerPeter Michael Green <plugwash@raspbian.org>
Fri, 7 May 2021 07:36:26 +0000 (08:36 +0100)
commit0d259ef7cc556ad33853bfcabc2c771c4b462e41
tree8c85a30679d950547bdbb0a91d45371825a4543e
parent9d14b7dd6a50eac3d8e4aacc99e13e3bf1c967ae
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