You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/10/20 00:38:19 UTC

svn commit: r1186543 - /httpd/httpd/trunk/modules/aaa/mod_authn_socache.c

Author: sf
Date: Wed Oct 19 22:38:18 2011
New Revision: 1186543

URL: http://svn.apache.org/viewvc?rev=1186543&view=rev
Log:
Don't return a pointer to a stack variable
Found by cppcheck

Modified:
    httpd/httpd/trunk/modules/aaa/mod_authn_socache.c

Modified: httpd/httpd/trunk/modules/aaa/mod_authn_socache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/aaa/mod_authn_socache.c?rev=1186543&r1=1186542&r2=1186543&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/aaa/mod_authn_socache.c (original)
+++ httpd/httpd/trunk/modules/aaa/mod_authn_socache.c Wed Oct 19 22:38:18 2011
@@ -399,7 +399,6 @@ static authn_status get_realm_hash(reque
         /* 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(reque
                       "Error accessing authentication cache");
         return AUTH_USER_NOT_FOUND;
     }
-    *rethash = (char*)val;
+    *rethash = apr_pstrmemdup(r->pool, (char *)val, vallen);
 
     return AUTH_USER_FOUND;
 }