File apache-tomcat-accept-extra-amp-in-parameters.patch of Package tomcat6.import5765
Index: apache-tomcat-6.0.32-src/java/org/apache/tomcat/util/http/LocalStrings.properties
===================================================================
--- apache-tomcat-6.0.32-src.orig/java/org/apache/tomcat/util/http/LocalStrings.properties 2012-02-06 13:44:33.982304516 +0100
+++ apache-tomcat-6.0.32-src/java/org/apache/tomcat/util/http/LocalStrings.properties 2012-02-06 13:44:34.282314642 +0100
@@ -17,6 +17,7 @@
parameters.copyFail=Failed to create copy of original parameter values for debug logging purposes
parameters.decodeFail.debug=Character decoding failed. Parameter [{0}] with value [{1}] has been ignored.
parameters.decodeFail.info=Character decoding failed. Parameter [{0}] with value [{1}] has been ignored. Note that the name and value quoted here may be corrupted due to the failed decoding. Use debug level logging to see the original, non-corrupted values.
+parameters.emptyChunk=Empty parameter chunk ignored
parameters.invalidChunk=Invalid chunk starting at byte [{0}] and ending at byte [{1}] with a value of [{2}] ignored
parameters.maxCountFail=More than the maximum number of request parameters (GET plus POST) for a single request ([{0}]) were detected. Any parameters beyond this limit have been ignored. To change this limit, set the maxParameterCount attribute on the Connector.
parameters.multipleDecodingFail=Character decoding failed. A total of [{0}] failures were detected but only the first was logged. Enable debug level logging for this logger to log all failures.
Index: apache-tomcat-6.0.32-src/java/org/apache/tomcat/util/http/Parameters.java
===================================================================
--- apache-tomcat-6.0.32-src.orig/java/org/apache/tomcat/util/http/Parameters.java 2012-02-06 13:44:34.266314102 +0100
+++ apache-tomcat-6.0.32-src/java/org/apache/tomcat/util/http/Parameters.java 2012-02-06 13:44:34.283314676 +0100
@@ -315,6 +315,15 @@
}
if (nameEnd <= nameStart ) {
+ if (valueStart == -1) {
+ // &&
+ if (log.isDebugEnabled()) {
+ log.debug(sm.getString("parameters.emptyChunk"));
+ }
+ // Do not flag as error
+ continue;
+ }
+ // &=foo&
if (log.isInfoEnabled()) {
if (valueEnd >= nameStart && log.isDebugEnabled()) {
String extract = null;
@@ -342,7 +351,11 @@
}
tmpName.setBytes(bytes, nameStart, nameEnd - nameStart);
- tmpValue.setBytes(bytes, valueStart, valueEnd - valueStart);
+ if (valueStart >= 0) {
+ tmpValue.setBytes(bytes, valueStart, valueEnd - valueStart);
+ } else {
+ tmpValue.setBytes(bytes, 0, 0);
+ }
// Take copies as if anything goes wrong originals will be
@@ -351,7 +364,11 @@
if (log.isDebugEnabled()) {
try {
origName.append(bytes, nameStart, nameEnd - nameStart);
- origValue.append(bytes, valueStart, valueEnd - valueStart);
+ if (valueStart >= 0) {
+ origValue.append(bytes, valueStart, valueEnd - valueStart);
+ } else {
+ origValue.append(bytes, 0, 0);
+ }
} catch (IOException ioe) {
// Should never happen...
log.error(sm.getString("parameters.copyFail"), ioe);
@@ -368,11 +385,15 @@
tmpName.setCharset(charset);
name = tmpName.toString();
- if (decodeValue) {
- urlDecode(tmpValue);
+ if (valueStart >= 0) {
+ if (decodeValue) {
+ urlDecode(tmpValue);
+ }
+ tmpValue.setCharset(charset);
+ value = tmpValue.toString();
+ } else {
+ value = "";
}
- tmpValue.setCharset(charset);
- value = tmpValue.toString();
addParam(name, value);
} catch (IOException e) {
Index: apache-tomcat-6.0.32-src/webapps/docs/changelog.xml
===================================================================
--- apache-tomcat-6.0.32-src.orig/webapps/docs/changelog.xml 2012-02-06 13:44:34.268314170 +0100
+++ apache-tomcat-6.0.32-src/webapps/docs/changelog.xml 2012-02-06 13:44:34.285314744 +0100
@@ -352,6 +352,14 @@
JreMemoryLeakPreventionListener to the WebappClassLoader since the
thread that triggers the memory leak is created on demand. (markt)
</fix>
+ <fix>
+ <bug>52384</bug>: Do not fail with parameter parsing when debug logging
+ is enabled. (kkolinko)
+ </fix>
+ <fix>
+ Do not flag extra '&' characters in parameters as parse errors.
+ (kkolinko)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">