This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 5ebfd0445e Avoid possible NPE
5ebfd0445e is described below
commit 5ebfd0445ef87c9fac8002717596e7c30f97701c
Author: remm <[email protected]>
AuthorDate: Mon Jan 5 17:03:38 2026 +0100
Avoid possible NPE
Resetting the socket leads to possible concurrency issues that are hard
to eliminate.
---
java/org/apache/tomcat/util/net/NioChannel.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/tomcat/util/net/NioChannel.java
b/java/org/apache/tomcat/util/net/NioChannel.java
index 672f3a664a..5c3eb2af36 100644
--- a/java/org/apache/tomcat/util/net/NioChannel.java
+++ b/java/org/apache/tomcat/util/net/NioChannel.java
@@ -54,7 +54,11 @@ public class NioChannel implements ByteChannel,
ScatteringByteChannel, Gathering
* @throws IOException If a problem was encountered resetting the channel
*/
public void reset(SocketChannel channel, NioSocketWrapper socketWrapper)
throws IOException {
- this.sc = channel;
+ // Don't reset socket on null as it can lead to NPEs
+ if (channel != null) {
+ this.sc = channel;
+ }
+ // Resetting socketWrapper is possible
this.socketWrapper = socketWrapper;
bufHandler.reset();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]