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

lihan 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 0feed3deb8 Avoid potential IndexOutOfBoundsException when matching 
HTTP/2 preface. Submitted #551 by 刘文章.
0feed3deb8 is described below

commit 0feed3deb8689082d1f153c164ee1e836d063328
Author: lihan <li...@apache.org>
AuthorDate: Wed Sep 7 14:40:51 2022 +0800

    Avoid potential IndexOutOfBoundsException when matching HTTP/2 preface. 
Submitted #551 by 刘文章.
---
 java/org/apache/coyote/http11/Http11InputBuffer.java | 2 +-
 webapps/docs/changelog.xml                           | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java 
b/java/org/apache/coyote/http11/Http11InputBuffer.java
index eef700d5f5..608e2b1fb6 100644
--- a/java/org/apache/coyote/http11/Http11InputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11InputBuffer.java
@@ -381,7 +381,7 @@ public class Http11InputBuffer implements InputBuffer, 
ApplicationBufferHandler
                     // Switch to the socket timeout.
                     
wrapper.setReadTimeout(wrapper.getEndpoint().getConnectionTimeout());
                 }
-                if (!keptAlive && byteBuffer.position() == 0 && 
byteBuffer.limit() >= CLIENT_PREFACE_START.length - 1) {
+                if (!keptAlive && byteBuffer.position() == 0 && 
byteBuffer.limit() >= CLIENT_PREFACE_START.length) {
                     boolean prefaceMatch = true;
                     for (int i = 0; i < CLIENT_PREFACE_START.length && 
prefaceMatch; i++) {
                         if (CLIENT_PREFACE_START[i] != byteBuffer.get(i)) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b304535e52..0d65d7aeca 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -172,6 +172,11 @@
         the maximum value to 255. Based on a PR <pr>548</pr> by Stefan Mayr.
         (lihan)
       </fix>
+      <fix>
+        <pr>551</pr>: Avoid potential IndexOutOfBoundsException by fixing
+        incorrect check when matching HTTP/2 preface. Submitted by 刘文章.
+        (lihan)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


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

Reply via email to