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

remm 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 a32a72760c Check read return value
a32a72760c is described below

commit a32a72760c718bda12752ff114ffb07ac2df31ad
Author: remm <r...@apache.org>
AuthorDate: Tue Sep 19 15:10:30 2023 +0200

    Check read return value
    
    Although "not needed" technically, it is a lot clearer to simply check
    it as usual and the exit from processing is a lot faster.
    Found by coverity.
---
 java/org/apache/tomcat/util/net/SecureNioChannel.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/SecureNioChannel.java 
b/java/org/apache/tomcat/util/net/SecureNioChannel.java
index ef2ba19945..b15f15db06 100644
--- a/java/org/apache/tomcat/util/net/SecureNioChannel.java
+++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java
@@ -265,7 +265,9 @@ public class SecureNioChannel extends NioChannel {
                     Integer.toString(newLimit)));
 
             netInBuffer = ByteBufferUtils.expand(netInBuffer, newLimit);
-            sc.read(netInBuffer);
+            if (sc.read(netInBuffer) < 0) {
+                return -1;
+            }
             extractor = new TLSClientHelloExtractor(netInBuffer);
         }
 


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

Reply via email to