You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mg...@apache.org on 2020/08/27 11:49:57 UTC
[tomcat] branch 7.0.x updated: Check earlier for valid first
character
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/7.0.x by this push:
new 91fac27 Check earlier for valid first character
91fac27 is described below
commit 91fac278b92ad33136ec6825fa557a19f426e808
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Tue Aug 25 14:28:11 2020 +0300
Check earlier for valid first character
Move the check for the possible characters in the first position
---
java/org/apache/catalina/connector/CoyoteAdapter.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java
index ea339c0..ab4551e 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -1272,6 +1272,12 @@ public class CoyoteAdapter implements Adapter {
int pos = 0;
int index = 0;
+
+ // The URL must start with '/' (or '\' that will be replaced soon)
+ if (b[start] != (byte) '/' && b[start] != (byte) '\\') {
+ return false;
+ }
+
// Replace '\' with '/'
// Check for null byte
for (pos = start; pos < end; pos++) {
@@ -1287,11 +1293,6 @@ public class CoyoteAdapter implements Adapter {
}
}
- // The URL must start with '/'
- if (b[start] != (byte) '/') {
- return false;
- }
-
// Replace "//" with "/"
for (pos = start; pos < (end - 1); pos++) {
if (b[pos] == (byte) '/') {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org