From: Stefan Fritsch Date: Wed, 19 Oct 2011 22:38:18 +0000 (+0000) Subject: Don't return a pointer to a stack variable X-Git-Tag: 2.3.15~111 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=64ea7a2b2f6617f2005498f6b441589b002c8b9b;p=apache Don't return a pointer to a stack variable Found by cppcheck git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1186543 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/aaa/mod_authn_socache.c b/modules/aaa/mod_authn_socache.c index 60a7c7aaa3..bfe4c7bf33 100644 --- a/modules/aaa/mod_authn_socache.c +++ b/modules/aaa/mod_authn_socache.c @@ -399,7 +399,6 @@ static authn_status get_realm_hash(request_rec *r, const char *user, /* OK, we got a value */ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Authn cache: found credentials for %s", user); - val[vallen] = 0; } else { /* error: give up and pass the buck */ @@ -408,7 +407,7 @@ static authn_status get_realm_hash(request_rec *r, const char *user, "Error accessing authentication cache"); return AUTH_USER_NOT_FOUND; } - *rethash = (char*)val; + *rethash = apr_pstrmemdup(r->pool, (char *)val, vallen); return AUTH_USER_FOUND; }