From c01a178ece6740f719fef81ecdf9283b5c8b71d5 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 13 Nov 2014 19:44:01 +0000 Subject: Marc Finet: problems with working directory rationalisation. Ensure the length of the directory is kept up to date. Abort following symlinks as soon as there's an error. --- Src/utils.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Src') diff --git a/Src/utils.c b/Src/utils.c index e6eb8e6a7..c6e7aed35 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -727,7 +727,7 @@ xsymlinks(char *s) zulong xbuflen = strlen(xbuf); opp = pp = slashsplit(s); - for (; xbuflen < sizeof(xbuf) && *pp; pp++) { + for (; xbuflen < sizeof(xbuf) && *pp && ret >= 0; pp++) { if (!strcmp(*pp, ".")) continue; if (!strcmp(*pp, "..")) { @@ -762,9 +762,13 @@ xsymlinks(char *s) strcpy(xbuf, ""); if (xsymlinks(xbuf3 + 1) < 0) ret = -1; + else + xbuflen = strlen(xbuf); } else if (xsymlinks(xbuf3) < 0) ret = -1; + else + xbuflen = strlen(xbuf); } } freearray(opp); -- cgit 1.4.1