Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Leen-Meyer:test
tomcat6
apache-tomcat-CVE-2012-4431.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File apache-tomcat-CVE-2012-4431.patch of Package tomcat6
Index: apache-tomcat-6.0.33-src/java/org/apache/catalina/filters/CsrfPreventionFilter.java =================================================================== --- apache-tomcat-6.0.33-src.orig/java/org/apache/catalina/filters/CsrfPreventionFilter.java 2013-01-02 14:04:15.666868607 +0100 +++ apache-tomcat-6.0.33-src/java/org/apache/catalina/filters/CsrfPreventionFilter.java 2013-01-02 14:06:10.113885894 +0100 @@ -33,6 +33,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; +import javax.servlet.http.HttpSession; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; @@ -153,16 +154,19 @@ } } + HttpSession session = req.getSession(false); + @SuppressWarnings("unchecked") - LruCache<String> nonceCache = - (LruCache<String>) req.getSession(true).getAttribute( - Constants.CSRF_NONCE_SESSION_ATTR_NAME); - + LruCache<String> nonceCache = (session == null) ? null + : (LruCache<String>) session.getAttribute( + Constants.CSRF_NONCE_SESSION_ATTR_NAME); + if (!skipNonceCheck) { String previousNonce = req.getParameter(Constants.CSRF_NONCE_REQUEST_PARAM); - if (nonceCache != null && !nonceCache.contains(previousNonce)) { + if (nonceCache == null || previousNonce == null || + !nonceCache.contains(previousNonce)) { res.sendError(HttpServletResponse.SC_FORBIDDEN); return; } @@ -170,7 +174,10 @@ if (nonceCache == null) { nonceCache = new LruCache<String>(nonceCacheSize); - req.getSession().setAttribute( + if (session == null) { + session = req.getSession(true); + } + session.setAttribute( Constants.CSRF_NONCE_SESSION_ATTR_NAME, nonceCache); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor