You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Takashi Sato <ta...@lans-tv.com> on 2008/11/03 14:40:42 UTC

[patch] mod_autoindex stability depends on ap_field_noparam

find_default_item passes an imperfect request_rec to find_item.
find_item calls ap_field_noparam with uninitialized memory pool (r->pool).
Though this doesn't matter since ap_field_noparam simply returns NULL when
the 2nd argument is NULL, IMHO this should be fixed.
The attached patch makes find_default_item stop create reqest_rec.


static char *find_item(request_rec *r, apr_array_header_t *list, int path_only)
{
    const char *content_type = ap_field_noparam(r->pool, r->content_type);

[cut]

static char *find_default_item(char *bogus_name, apr_array_header_t *list)
{
    request_rec r;
    /* Bleah.  I tried to clean up find_item, and it lead to this bit
     * of ugliness.   Note that the fields initialized are precisely
     * those that find_item looks at...
     */
    r.filename = bogus_name;
    r.content_type = r.content_encoding = NULL;
    return find_item(&r, list, 1);
}