diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-16 21:07:49 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-16 21:07:49 +0000 |
| commit | a6221519650f8b065f50d665e0ef9d683ad66703 (patch) | |
| tree | db7bc8a488a946b8b2b8ad526e59cf616b0fcc88 /util | |
| parent | ea9d1085297d581837cf45f3d1208ebf338af4eb (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; |
