From: Justin Erenkrantz Date: Fri, 31 May 2002 16:59:13 +0000 (+0000) Subject: Fix segfault when x hasn't been initialized and tighten its scope. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=39b200cf38fefc7ebdccc2e5a6f97c09fd7e033b;p=apache Fix segfault when x hasn't been initialized and tighten its scope. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95443 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/mappers/mod_userdir.c b/modules/mappers/mod_userdir.c index 9a29b35145..85c32af08f 100644 --- a/modules/mappers/mod_userdir.c +++ b/modules/mappers/mod_userdir.c @@ -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;