This is an automated email from the ASF dual-hosted git repository.
markt-asf 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 b48113a37b Follow-on to "Send the server shutdown command as UTF-8 ..."
b48113a37b is described below
commit b48113a37b476283a349debcd933adbf8b9896c9
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Oct 19 20:18:16 2026 +0100
Follow-on to "Send the server shutdown command as UTF-8 ..."
Count bytes not characters since UTF-8 is multi-byte
---
java/org/apache/catalina/core/StandardServer.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/catalina/core/StandardServer.java
b/java/org/apache/catalina/core/StandardServer.java
index eec1a03501..b649411221 100644
--- a/java/org/apache/catalina/core/StandardServer.java
+++ b/java/org/apache/catalina/core/StandardServer.java
@@ -580,9 +580,10 @@ public final class StandardServer extends
LifecycleMBeanBase implements Server {
break;
}
- // Read a set of characters from the socket
+ // Read a set of bytes from the socket
int expected = 1024; // Cut off to avoid DoS attack
- while (expected < shutdown.length()) {
+ int shutdownLength =
shutdown.getBytes(StandardCharsets.UTF_8).length;
+ while (expected < shutdownLength) {
if (random == null) {
random = new Random();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]