mirror of
https://github.com/stefanberger/swtpm.git
synced 2026-01-25 17:39:01 +00:00
swtpm: Do not follow symlinks when opening lockfile (CVE-2020-28407)
This patch addresses CVE-2020-28407. Prevent us from following symliks when we open the lockfile for writing. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
401c9e57a7
commit
110ab4c908
@ -210,7 +210,7 @@ static TPM_RESULT SWTPM_NVRAM_Lock_Lockfile(const char *directory,
|
||||
return TPM_FAIL;
|
||||
}
|
||||
|
||||
*fd = open(lockfile, O_WRONLY|O_CREAT|O_TRUNC, 0660);
|
||||
*fd = open(lockfile, O_WRONLY|O_CREAT|O_TRUNC|O_NOFOLLOW, 0660);
|
||||
if (*fd < 0) {
|
||||
logprintf(STDERR_FILENO,
|
||||
"SWTPM_NVRAM_Lock_Lockfile: Could not open lockfile: %s\n",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user