This is an automated email from the ASF dual-hosted git repository. markt-asf pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 7e41deb9a0898220d7e88b8970e817793999b3df 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 428e2de1ea..5194556b85 100644 --- a/java/org/apache/catalina/core/StandardServer.java +++ b/java/org/apache/catalina/core/StandardServer.java @@ -576,9 +576,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]
