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 4b33b7ddf4 Check for null
4b33b7ddf4 is described below

commit 4b33b7ddf40830b02ca5df3d71792da1579cee9b
Author: remm <[email protected]>
AuthorDate: Mon Mar 9 17:00:52 2026 +0100

    Check for null
    
    Since reset on close sets the engine to null, improve checks a little.
---
 java/org/apache/tomcat/util/net/SecureNioChannel.java | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/SecureNioChannel.java 
b/java/org/apache/tomcat/util/net/SecureNioChannel.java
index 95b9754745..bb43c5c098 100644
--- a/java/org/apache/tomcat/util/net/SecureNioChannel.java
+++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java
@@ -608,7 +608,8 @@ public class SecureNioChannel extends NioChannel {
     @Override
     public int read(ByteBuffer dst) throws IOException {
         // are we in the middle of closing or closed?
-        if (closing || closed) {
+        SSLEngine sslEngine = this.sslEngine;
+        if (closing || closed || sslEngine == null) {
             return -1;
         }
         // did we finish our handshake?
@@ -695,7 +696,8 @@ public class SecureNioChannel extends NioChannel {
     @Override
     public long read(ByteBuffer[] dsts, int offset, int length) throws 
IOException {
         // are we in the middle of closing or closed?
-        if (closing || closed) {
+        SSLEngine sslEngine = this.sslEngine;
+        if (closing || closed || sslEngine == null) {
             return -1;
         }
         // did we finish our handshake?
@@ -826,7 +828,8 @@ public class SecureNioChannel extends NioChannel {
             return sc.write(src);
         } else {
             // Are we closing or closed?
-            if (closing || closed) {
+            SSLEngine sslEngine = this.sslEngine;
+            if (closing || closed || sslEngine == null) {
                 throw new IOException(sm.getString("channel.nio.ssl.closing"));
             }
 
@@ -869,7 +872,8 @@ public class SecureNioChannel extends NioChannel {
     public long write(ByteBuffer[] srcs, int offset, int length) throws 
IOException {
         checkInterruptStatus();
         // Are we closing or closed?
-        if (closing || closed) {
+        SSLEngine sslEngine = this.sslEngine;
+        if (closing || closed || sslEngine == null) {
             throw new IOException(sm.getString("channel.nio.ssl.closing"));
         }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to