This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new 6ad63549f3 Follow-on to "Send the server shutdown command as UTF-8 ..."
6ad63549f3 is described below

commit 6ad63549f3720dcdcd3fd8bf1eb0cb852749be77
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]

Reply via email to