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

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


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

commit c043c290bd5378216820ccfa25cc795d27d86140
Author: Mark Thomas <[email protected]>
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 dd0425a..9b3aa26 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -886,7 +886,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;
                         }
@@ -899,7 +899,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 50b4a15..07e9038 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -104,6 +104,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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to