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 350fd54047 Fix unlikely NPE
350fd54047 is described below
commit 350fd5404797ed1d49052dff409067bc7b53eabf
Author: remm <[email protected]>
AuthorDate: Mon Sep 18 12:53:38 2023 +0200
Fix unlikely NPE
Found by coverity.
---
java/org/apache/tomcat/util/net/NioEndpoint.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index e817945272..b0fc284a05 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1447,8 +1447,12 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
public SendfileState processSendfile(SendfileDataBase sendfileData) {
setSendfileData((SendfileData) sendfileData);
SelectionKey key =
getSocket().getIOChannel().keyFor(getPoller().getSelector());
- // Might as well do the first write on this thread
- return getPoller().processSendfile(key, this, true);
+ if (key == null) {
+ return SendfileState.ERROR;
+ } else {
+ // Might as well do the first write on this thread
+ return getPoller().processSendfile(key, this, true);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]