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

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new a1cc4e94a1 Check read return value
a1cc4e94a1 is described below

commit a1cc4e94a17589f2edb28c4d6807fb28252130e9
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 c3f3c0477d..23b420a4fc 100644
--- a/java/org/apache/tomcat/util/net/SecureNioChannel.java
+++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java
@@ -263,7 +263,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