summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--Src/utils.c8
2 files changed, 16 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 642579cc9..3eadca8f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-01-05 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 28568 c.f. 28549 (Ricky Zhou): Src/utils.c: buffer overflow
+ examining paths.
+
+ * Alexey: 28557: Completion/Unix/Command/_ri: update for new
+ versions of Ruby.
+
2010-12-25 Clint Adams <clint@zsh.org>
* 28548: Completion/Unix/Command/_fuser: match psmisc in any case.
@@ -14035,5 +14043,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5167 $
+* $Revision: 1.5168 $
*****************************************************
diff --git a/Src/utils.c b/Src/utils.c
index b64530bcc..a1cac2537 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3667,16 +3667,22 @@ mindist(char *dir, char *mindistguess, char *mindistbest)
int mindistd, nd;
DIR *dd;
char *fn;
- char buf[PATH_MAX];
+ char *buf;
if (dir[0] == '\0')
dir = ".";
mindistd = 100;
+
+ buf = zalloc(strlen(dir) + strlen(mindistguess) + 2);
sprintf(buf, "%s/%s", dir, mindistguess);
+
if (access(unmeta(buf), F_OK) == 0) {
strcpy(mindistbest, mindistguess);
+ free(buf);
return 0;
}
+ free(buf);
+
if (!(dd = opendir(unmeta(dir))))
return mindistd;
while ((fn = zreaddir(dd, 0))) {