diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-16 22:02:17 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-26 06:59:42 +0000 |
| commit | cf8cb4bdcc12af8ad5d4d17ed6782b4c83f1ea38 (patch) | |
| tree | fd9d062789e85768b61614f214dc781f2f86252e | |
| parent | ab8929808f2a9addac56f5248481e84f619df872 (diff) | |
util/nvmutil: check fd path in try_fdpath
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -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); } |
