mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-03-25 13:29:03 +02:00
mkhtemp: fail if TMPDIR is SET, but set wrong
right now we defer to fallbacks otherwise, which is wrong. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -453,16 +453,20 @@ env_tmpdir(int bypass_all_sticky_checks)
|
|||||||
if (t != NULL && *t != '\0') {
|
if (t != NULL && *t != '\0') {
|
||||||
|
|
||||||
if (tmpdir_policy(t,
|
if (tmpdir_policy(t,
|
||||||
&allow_noworld_unsticky) == 0) {
|
&allow_noworld_unsticky) < 0) {
|
||||||
|
errno = EPERM;
|
||||||
if (world_writeable_and_sticky(t,
|
return NULL; /* errno already set */
|
||||||
allow_noworld_unsticky,
|
|
||||||
bypass_all_sticky_checks)) {
|
|
||||||
|
|
||||||
errno = saved_errno;
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!world_writeable_and_sticky(t,
|
||||||
|
allow_noworld_unsticky,
|
||||||
|
bypass_all_sticky_checks)) {
|
||||||
|
errno = EPERM;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
errno = saved_errno;
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
allow_noworld_unsticky = 0;
|
allow_noworld_unsticky = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user