You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/05/17 17:08:24 UTC

[tomcat] branch 8.5.x updated: Fix rare potential NPE identified by Coverity Scan.

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new c14bc02  Fix rare potential NPE identified by Coverity Scan.
c14bc02 is described below

commit c14bc021f8337873f850db4cd05a0451d484a8ed
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri May 17 18:05:46 2019 +0100

    Fix rare potential NPE identified by Coverity Scan.
---
 java/org/apache/catalina/connector/CoyoteAdapter.java | 6 ++++--
 webapps/docs/changelog.xml                            | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java
index 50f68ec..a2a59bb 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -817,7 +817,7 @@ public class CoyoteAdapter implements Adapter {
             if (wrapper != null) {
                 String[] methods = wrapper.getServletMethods();
                 if (methods != null) {
-                    for (int i=0; i<methods.length; i++) {
+                    for (int i=0; i < methods.length; i++) {
                         if ("TRACE".equals(methods[i])) {
                             continue;
                         }
@@ -830,7 +830,9 @@ public class CoyoteAdapter implements Adapter {
                 }
             }
             res.setStatus(405);
-            res.addHeader("Allow", header);
+            if (header != null) {
+                res.addHeader("Allow", header);
+            }
             res.setMessage("TRACE method is not allowed");
             request.getContext().logAccess(request, response, 0, true);
             return false;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 4041c50..de11eb5 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -54,6 +54,10 @@
         Ensure that the default servlet reads the entire global XSLT file if
         one is defined. Identified by Coverity Scan. (markt)
       </fix>
+      <fix>
+        Avoid potential <code>NullPointerException</code> when generating an
+        HTTP <code>Allow</code> header. Identified by Coverity Scan. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org