Details
-
Type:
Task
-
Status: Resolved (View workflow)
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects versions: 4.1.3
-
Fix versions: 4.4.0
-
Components: Core
-
Labels:None
Description
Check for exact lengths of both strings instead of > 0. We have one additional length check but the string conversions happen only when the string length matches.
This change should be save, anyhow comments are welcome.
Â
// change this if (head.length() > 0 && ("/stream:stream>".equals(head.toString()) || ("/flash:stream>".equals(head.toString())))) {    // Found closing stream:stream    foundMsg("</stream:stream>"); } // to (details not checked, lengths may be wrong!): if ( (head.length() == ?16? && "/stream:stream>".equals(head.toString()) || (head.length() == ?15? && "/flash:stream>".equals(head.toString()) ) {    // Found closing stream:stream    foundMsg("</stream:stream>"); }
And as we know that the length of head will get ~16 bytes one could initialize it with at least 16 bytes to avoid that the JVM extends the buffer during runtime. Currently 5 bytes are used: "protected StringBuilder head = new StringBuilder(5);"
Â
Â