]> granicus.if.org Git - apache/commitdiff
Fix segfault when x hasn't been initialized and tighten its scope.
authorJustin Erenkrantz <jerenkrantz@apache.org>
Fri, 31 May 2002 16:59:13 +0000 (16:59 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Fri, 31 May 2002 16:59:13 +0000 (16:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95443 13f79535-47bb-0310-9956-ffa450edef68

modules/mappers/mod_userdir.c

index 9a29b35145df37e9c397f947e6eb542f6c1ba19e..85c32af08f0b2601aaf0faa9d5fd26a15b4bdae8 100644 (file)
@@ -227,7 +227,6 @@ static int translate_userdir(request_rec *r)
     const char *userdirs;
     const char *w, *dname;
     char *redirect;
-    char *x = NULL;
     apr_finfo_t statbuf;
 
     /*
@@ -285,7 +284,7 @@ static int translate_userdir(request_rec *r)
 
     while (*userdirs) {
         const char *userdir = ap_getword_conf(r->pool, &userdirs);
-        char *filename = NULL;
+        char *filename = NULL, *x = NULL;
         apr_status_t rv;
         int is_absolute = ap_os_is_path_absolute(r->pool, userdir);
 
@@ -317,7 +316,7 @@ static int translate_userdir(request_rec *r)
             else
                 filename = apr_pstrcat(r->pool, userdir, "/", w, NULL);
         }
-        else if (ap_strchr_c(x, ':')) {
+        else if (x && ap_strchr_c(x, ':')) {
             redirect = apr_pstrcat(r->pool, x, w, dname, NULL);
             apr_table_setn(r->headers_out, "Location", redirect);
             return HTTP_MOVED_TEMPORARILY;