diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-16 21:07:49 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-26 06:59:42 +0000 |
| commit | 1207b1bb726a556de2eae53c10364e36ff951e8e (patch) | |
| tree | 1054944408d12ec2b36cdbbb5c7552ae1681f8cc /util | |
| parent | ddb0bc314de7353c2df04a7c09c5028c05cfaec6 (diff) | |
util/nvmutil: dir fsync with O_DIRECTORY
guards against replacement attacks, on systems
that support this flag
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 8fff62e4..ce4011c1 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -2150,7 +2150,11 @@ fsync_dir(const char *path) strcpy(dirbuf, "."); } - dfd = open(dirbuf, O_RDONLY); + dfd = open(dirbuf, O_RDONLY +#ifdef O_DIRECTORY + | O_DIRECTORY +#endif + ); if (dfd == -1) goto err_fsync_dir; |
