mkhtemp: harden tmpdir access control

faccessat used this way respects uid/gid,
handles ACLs (where used), and matches whatt
many real security tools might do.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-24 20:18:15 +00:00
parent b16bb6c445
commit 715723c7ce

View File

@@ -475,6 +475,12 @@ world_writeable_and_sticky(
goto sticky_hell; /* not sticky */
}
/* if anyone even looks at you funny, drop
* everything on the floor and refuse to function
*/
if (faccessat(dirfd, ".", X_OK, AT_EACCESS) < 0)
goto sticky_hell;
/* non-world-writeable, so
* stickiness is do-not-care
*/