From 64ea7a2b2f6617f2005498f6b441589b002c8b9b Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Wed, 19 Oct 2011 22:38:18 +0000 Subject: [PATCH] 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 --- modules/aaa/mod_authn_socache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/aaa/mod_authn_socache.c b/modules/aaa/mod_authn_socache.c index 60a7c7aaa3f..bfe4c7bf336 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; } -- 2.47.2