From 07e0b89c3b03d2726cff8841dcf7f8900d8bfa97 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Fri, 10 Dec 2004 15:54:17 +0000 Subject: [PATCH] Dangerous assumption, especially if apr_dir_read uses readdir_r. Be safe. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@111516 13f79535-47bb-0310-9956-ffa450edef68 --- support/htcacheclean.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/support/htcacheclean.c b/support/htcacheclean.c index fd5e3ab8336..d505ecb777c 100644 --- a/support/htcacheclean.c +++ b/support/htcacheclean.c @@ -348,11 +348,9 @@ static int process_dir(char *path, apr_pool_t *pool) } while (apr_dir_read(&info, 0, dir) == APR_SUCCESS && !interrupted) { - /* skip first two entries which will always be '.' and '..' */ - if (skip < 2) { - skip++; - continue; - } + if (!strcmp(info.name, ".") || !strcmp(info.name, "..")) { + continue; + } d = apr_pcalloc(p, sizeof(DIRENTRY)); d->basename = apr_pstrcat(p, path, "/", info.name, NULL); APR_RING_INSERT_TAIL(&anchor, d, _direntry, link); -- 2.47.2