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 cc82fcfb81 Review "Avoid StringIndexOutOfBoundsException on an empty 
..."
cc82fcfb81 is described below

commit cc82fcfb8161b6b0ba5f69ba2bed4139113983f2
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Nov 6 10:35:21 2026 +0000

    Review "Avoid StringIndexOutOfBoundsException on an empty ..."
    
    Fix additional variations of the same issue
    
    Co-authored by: Claude / Sonnet 5.5
---
 java/org/apache/jasper/tagplugins/jstl/Util.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/jasper/tagplugins/jstl/Util.java 
b/java/org/apache/jasper/tagplugins/jstl/Util.java
index 9c8f8054e4..ee459ce062 100644
--- a/java/org/apache/jasper/tagplugins/jstl/Util.java
+++ b/java/org/apache/jasper/tagplugins/jstl/Util.java
@@ -163,7 +163,9 @@ public class Util {
                 end = input.length();
             }
         }
-        return input.substring(begin, end).strip();
+        String value = input.substring(begin, end).strip();
+        // An empty value (e.g. charset="" or charset=;foo=bar) is treated the 
same as an absent attribute
+        return value.isEmpty() ? null : value;
     }
 
     /**


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to