diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-16 22:02:17 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-16 22:02:17 +0000 |
| commit | 4f581950c28eeeac38c387e891f36a5bcf2f438f (patch) | |
| tree | 9b0ea2b833d4d8cd1e71c01194d4b05ba92e4286 /util/nvmutil | |
| parent | 045d85dcc57fc32cd89ed695ab1d85fc5f680973 (diff) | |
util/nvmutil: check fd path in try_fdpath
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index b40a0910..c7093501 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -3231,6 +3231,8 @@ x_try_fdpath(const char *prefix, int fd, mode_t mode) unsigned long i = 0; unsigned long j; + struct stat st; + while (prefix[i]) { if (i >= PATH_LEN - 1) return -1; @@ -3246,6 +3248,9 @@ x_try_fdpath(const char *prefix, int fd, mode_t mode) i += j; path[i] = '\0'; + if (stat(path, &st) < 0) + return -1; + return chmod(path, mode); } |
