summaryrefslogtreecommitdiff
path: root/util/nvmutil/nvmutil.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-16 22:02:17 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-16 22:02:17 +0000
commit4f581950c28eeeac38c387e891f36a5bcf2f438f (patch)
tree9b0ea2b833d4d8cd1e71c01194d4b05ba92e4286 /util/nvmutil/nvmutil.c
parent045d85dcc57fc32cd89ed695ab1d85fc5f680973 (diff)
util/nvmutil: check fd path in try_fdpath
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil/nvmutil.c')
-rw-r--r--util/nvmutil/nvmutil.c5
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);
}