Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: hashcmd could reject valid paths to hash if they had metafied characters
- X-seq: zsh-workers 54597
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: hashcmd could reject valid paths to hash if they had metafied characters
- Date: Sat, 23 May 2026 08:37:06 +0200
- Archived-at: <https://zsh.org/workers/54597>
- List-id: <zsh-workers.zsh.org>
And the iscom takes care of paths that are actually too long for us.
---
Src/exec.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Src/exec.c b/Src/exec.c
index 98cbb1f609..2a622230aa 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1043,7 +1043,7 @@ mod_export Cmdnam
hashcmd(char *arg0, char **pp)
{
Cmdnam cn;
- char *s, buf[PATH_MAX+1];
+ char *s, buf[MAXCMDLEN];
char **pq;
if (*arg0 == '/')
@@ -1051,9 +1051,9 @@ hashcmd(char *arg0, char **pp)
for (; *pp; pp++)
if (**pp == '/') {
s = buf;
- struncpy(&s, *pp, PATH_MAX);
+ struncpy(&s, *pp, sizeof(buf) - 1);
*s++ = '/';
- if ((s - buf) + strlen(arg0) >= PATH_MAX)
+ if ((s - buf) + strlen(arg0) >= sizeof(buf))
continue;
strcpy(s, arg0);
if (iscom(buf))
--
2.38.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author