mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 05:52:36 +02:00
util/nvmutil: check fd path in try_fdpath
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -3231,6 +3231,8 @@ x_try_fdpath(const char *prefix, int fd, mode_t mode)
|
|||||||
unsigned long i = 0;
|
unsigned long i = 0;
|
||||||
unsigned long j;
|
unsigned long j;
|
||||||
|
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
while (prefix[i]) {
|
while (prefix[i]) {
|
||||||
if (i >= PATH_LEN - 1)
|
if (i >= PATH_LEN - 1)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -3246,6 +3248,9 @@ x_try_fdpath(const char *prefix, int fd, mode_t mode)
|
|||||||
i += j;
|
i += j;
|
||||||
path[i] = '\0';
|
path[i] = '\0';
|
||||||
|
|
||||||
|
if (stat(path, &st) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
return chmod(path, mode);
|
return chmod(path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user