From: Jim Jagielski Date: Fri, 10 Dec 2004 15:54:17 +0000 (+0000) Subject: Dangerous assumption, especially if apr_dir_read uses readdir_r. X-Git-Tag: 2.1.3~283 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07e0b89c3b03d2726cff8841dcf7f8900d8bfa97;p=thirdparty%2Fapache%2Fhttpd.git 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 --- 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);