[PATCH] posix: execvpe: skip $PATH components that are too long
Pádraig Brady
P@draigBrady.com
Sat Nov 8 15:51:28 GMT 2025
* posix/execvpe.c (__execvpe_common): Rather than error out
with ENAMETOOLONG, just ignore and try the next path.
Note we know the FILE length is <= NAME_MAX, so the ENAMETOOLONG
almost certainly pertains to the current $PATH entry.
---
posix/execvpe.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/posix/execvpe.c b/posix/execvpe.c
index c139dfe8fd..0fb09b9631 100644
--- a/posix/execvpe.c
+++ b/posix/execvpe.c
@@ -156,6 +156,9 @@ __execvpe_common (const char *file, char *const argv[], char *const envp[],
/* Those errors indicate the file is missing or not executable
by us, in which case we want to just try the next path
directory. */
+ case ENAMETOOLONG:
+ /* We've already verified that the FILE length is < NAME_MAX,
+ so this implies a path component is too long, so skip it. */
case ENODEV:
case ETIMEDOUT:
/* Some strange filesystems like AFS return even
--
2.51.1
More information about the Libc-alpha
mailing list