fix race condition allowing attackers to access destination file
authorW. Felix Handte <w@felixhandte.com>
Mon, 1 Mar 2021 17:23:52 +0000 (17:23 +0000)
committerStephen Kitt <skitt@debian.org>
Mon, 1 Mar 2021 17:23:52 +0000 (17:23 +0000)
commit497f26598f1e8a7b2b487ff2ff598ddcb5c5b743
treed24edf4f4df83987753f79f665fe14f1fb71b6ff
parent8d62a8e526b7209dc367b787e10242a4a3c172ec
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