libreboot-utils: unified max path lengths

just use PATH_MAX like a normal person

with additional safety

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-31 07:42:40 +01:00
parent fb5f1b4ed1
commit 2f7623ff06
7 changed files with 26 additions and 78 deletions
+2 -8
View File
@@ -22,12 +22,6 @@
struct xstate *
xstart(int argc, char *argv[])
{
#if defined(PATH_LEN) && \
((PATH_LEN) >= 256)
static size_t maxlen = PATH_LEN;
#else
static size_t maxlen = 4096;
#endif
static int first_run = 1;
static char *dir = NULL;
static char *base = NULL;
@@ -119,7 +113,7 @@ xstart(int argc, char *argv[])
err_exit(errno, "xstart: don't know CWD of %s",
us.f.fname);
sdup(base, maxlen, &us.f.base);
sdup(base, PATH_MAX, &us.f.base);
us.f.dirfd = fs_open(dir,
O_RDONLY | O_DIRECTORY);
@@ -133,7 +127,7 @@ xstart(int argc, char *argv[])
&tmpdir, &tmpbase_local, 0) < 0)
err_exit(errno, "tmp basename");
sdup(tmpbase_local, maxlen, &us.f.tmpbase);
sdup(tmpbase_local, PATH_MAX, &us.f.tmpbase);
free_and_set_null(&tmpdir);