From 48dded4ab1209a030770ab67a789d3b2528b6329 Mon Sep 17 00:00:00 2001 From: Mark Emlyn David Thomas Date: Tue, 12 Jul 2011 12:51:35 +0000 Subject: [PATCH] Socket has been closed, return false so an attempt is not made to re-use the socket Part of the fix for CVE-2011-2526 git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1145571 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/tomcat/util/net/NioEndpoint.java | 1 + webapps/docs/changelog.xml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 2f5344f75354..8cd7c06bf2de 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -1271,6 +1271,7 @@ public boolean processSendfile(SelectionKey sk, KeyAttachment attachment, boolea log.debug("Send file connection is being closed"); } cancelledKey(sk,SocketStatus.STOP,false); + return false; } } else if ( attachment.interestOps() == 0 && reg ) { if (log.isDebugEnabled()) { diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index a0fa744c633b..d82ee63ec980 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -124,6 +124,10 @@ Protect against infinite loops in the HTTP NIO connector if sendfile is configured to send more data than is available in the file. (markt) + + Prevent NPEs when a socket is closed in non-error conditions after + sendfile processing when using the HTTP NIO connector. (markt) +