httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <n...@webthing.com>
Subject Re: svn commit: r634821 - in /httpd/httpd/trunk: CHANGES modules/ldap/util_ldap.c
Date Tue, 18 Mar 2008 22:01:37 GMT
On Fri, 07 Mar 2008 21:02:42 -0000
covener@apache.org wrote:


> Modified: httpd/httpd/trunk/modules/ldap/util_ldap.c
> URL:
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ldap/util_ldap.c?rev=634821&r1=634820&r2=634821&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/ldap/util_ldap.c (original) +++
> httpd/httpd/trunk/modules/ldap/util_ldap.c Fri Mar  7 13:02:41 2008
> @@ -1462,13 +1462,10 @@ /* ...and entry is valid */
>                  *binddn = apr_pstrdup(r->pool, search_nodep->dn);
>                  if (attrs) {
> -                    int i = 0, k = 0;
> -                    while (attrs[k++]);
> -                    *retvals = apr_pcalloc(r->pool, sizeof(char *) *
> k);
> -                    while (search_nodep->vals[i]) {
> -                        (*retvals)[i] = apr_pstrdup(r->pool,
> -
> search_nodep->vals[i]);
> -                        i++;
> +                    int i;
> +                    *retvals = apr_pcalloc(r->pool, sizeof(char *) *
> search_nodep->numvals);
> +                    for (i = 0; i < search_nodep->numvals; i++) {
> +                        (*retvals)[i] = apr_pstrdup(r->pool,
> search_nodep->vals[i]); }

Um, doesn't that need a not-null test to avoid a segfault?
If the switch from while(...) to for(...) does anything,
it must be 'cos there's a null in there, yesno?

Also, because I CBA to figure it out, I take it the
search_nodep->vals[i] must live on the stack and/or get
overwritten, so the copying is necessary?

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

Mime
View raw message