From 6c73ea2bf4ae6ad1e73b491c64a7a6d6a1566850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C5=8Dshin?= Date: Sun, 17 Dec 2023 08:02:05 -0500 Subject: [PATCH] remove realpath from m1 loader Noticed a bug in the process, pathlen is out of step with n --- ape/ape-m1.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ape/ape-m1.c b/ape/ape-m1.c index 0b5860e5c..874f452e1 100644 --- a/ape/ape-m1.c +++ b/ape/ape-m1.c @@ -316,21 +316,12 @@ __attribute__((__noreturn__)) static void Pexit(const char *c, int failed, } static char AccessCommand(struct PathSearcher *ps, unsigned long pathlen) { - char buf[PATH_MAX]; - size_t n; if (pathlen + 1 + ps->namelen + 1 > sizeof(ps->path)) { return 0; } if (pathlen && ps->path[pathlen - 1] != '/') ps->path[pathlen++] = '/'; memmove(ps->path + pathlen, ps->name, ps->namelen); ps->path[pathlen + ps->namelen] = 0; - if (!realpath(ps->path, buf)) { - Pexit(ps->path, -errno, "realpath"); - } - if ((n = strlen(buf)) >= sizeof(ps->path)) { - Pexit(buf, 0, "too long"); - } - memcpy(ps->path, buf, n + 1); if (!access(ps->path, X_OK)) { if (ps->indirect) { ps->namelen -= 4;