From: William A. Rowe Jr Date: Sat, 25 May 2002 20:02:16 +0000 (+0000) Subject: nelts returned from a registry key may be zero... make it so. X-Git-Tag: 2.0.37~264 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7091de1358377695cff4fa1a90b873291a21c402;p=thirdparty%2Fapache%2Fhttpd.git nelts returned from a registry key may be zero... make it so. [We previously would return an array of one empty element.] PR: 9410 Submitted by: Vasiliy Gagin git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95284 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/winnt/registry.c b/server/mpm/winnt/registry.c index b71831653ad..a877e722f09 100644 --- a/server/mpm/winnt/registry.c +++ b/server/mpm/winnt/registry.c @@ -266,26 +266,21 @@ apr_status_t ap_registry_get_array(apr_pool_t *p, const char *key, const char *n pValue, /* for value */ &nSize); /* for size of "value" */ - nSize = 1; /* Element Count */ - tmp = pValue; - while (tmp[0] || tmp[1]) - { - if (!tmp[0]) - ++nSize; - ++tmp; + nSize = 0; /* Element Count */ + for (tmp = pValue; *tmp; ++tmp) { + ++nSize; + while (*tmp) { + ++tmp; + } } - + *parray = apr_array_make(p, nSize, sizeof(char *)); - tmp = pValue; - newelem = (char **) apr_array_push(*parray); - *newelem = tmp; - while (tmp[0] || tmp[1]) - { - if (!tmp[0]) { - newelem = (char **) apr_array_push(*parray); - *newelem = tmp + 1; + for (tmp = pValue; *tmp; ++tmp) { + newelem = (char **) apr_array_push(*parray); + *newelem = tmp; + while (*tmp) { + ++tmp; } - ++tmp; } }