DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8075>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8075 Parameter parsing fails when the value has an '=' character in it Summary: Parameter parsing fails when the value has an '=' character in it Product: Tomcat 4 Version: 4.0.4 Beta 2 Platform: All OS/Version: All Status: NEW Severity: Major Priority: Other Component: Catalina AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] The "public static void parseParameters(Map map, byte[] data, String encoding)" method in org/apache/catalina/util/RequestUtil.java does not properly parse strings like "foo=ab&bar=cd&foobar=ef=gh^ij=kl". The parameter=value pairs should be "foo=ab", "bar=cd" and "foobar=ef=gh^ij=kl". The fix is to change the method so that it doesn't get tripped up on other '=' characters AFTER it has found the key. The following patch fixes this. Index: RequestUtil.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat- 4.0/catalina/src/share/org/apache/catalina/util/RequestUtil.java,v retrieving revision 1.19 diff -u -r1.19 RequestUtil.java --- RequestUtil.java 21 Feb 2002 22:51:55 -0000 1.19 +++ RequestUtil.java 14 Apr 2002 18:59:42 -0000 @@ -494,6 +494,7 @@ int ox = 0; String key = null; String value = null; + boolean keyFound = false; while (ix < data.length) { byte c = data[ix++]; switch ((char) c) { @@ -502,13 +503,10 @@ if (key != null) { putMapEntry(map, key, value); key = null; + keyFound = false; } ox = 0; break; - case '=': - key = new String(data, 0, ox, encoding); - ox = 0; - break; case '+': data[ox++] = (byte)' '; break; @@ -516,6 +514,16 @@ data[ox++] = (byte)((convertHexDigit(data[ix++]) << 4) + convertHexDigit(data[ix++])); break; + case '=': + if (keyFound == false) { + key = new String(data, 0, ox, encoding); + ox = 0; + keyFound = true; + break; + } + else { + // fall through and let the default statement handle it + } default: data[ox++] = c; } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>