util/nvmutil: initialise st in tmpdir

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-18 05:13:02 +00:00
parent 3b389d4aec
commit 71da2f53cf

View File

@@ -2999,10 +2999,14 @@ x_c_tmpdir(void)
char *t; char *t;
struct stat st; struct stat st;
t = getenv("TMPDIR");
t = getenv("TMPDIR"); t = getenv("TMPDIR");
if (t && *t) { if (t && *t) {
if ((st.st_mode & S_IWOTH) && !(st.st_mode & S_ISVTX)) if (stat(t, &st) == 0 && S_ISDIR(st.st_mode)) {
return NULL; if ((st.st_mode & S_IWOTH) && !(st.st_mode & S_ISVTX))
return NULL;
return t;
}
} }
if (stat("/tmp", &st) == 0 && S_ISDIR(st.st_mode)) if (stat("/tmp", &st) == 0 && S_ISDIR(st.st_mode))