PATCH: hashcmd could reject valid paths to hash if they had metafied characters
Mikael Magnusson <[email protected]>
| Newsgroups | gmane.comp.shells.zsh.devel |
|---|---|
| Message-ID | <[email protected]> |
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