summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-09-03 13:01:57 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-09-03 13:02:01 -0700
commit2aa4196f1fd02851976d2c214302d87ea26663d0 (patch)
tree4c65dafa491d9b9a82ac60b98d1b2ce34d9b2cba /org.eclipse.jgit/src
parent34a755f1df959bd34f9426143765e650665b1afb (diff)
downloadjgit-2aa4196f1fd02851976d2c214302d87ea26663d0.tar.gz
jgit-2aa4196f1fd02851976d2c214302d87ea26663d0.zip
Fix QuotedString.GIT_PATH escaping rules
We shouldn't escape non-special ASCII characters such as '@' or '~'. These are valid in a path name on POSIX systems, and may appear as part of a path in a GNU or Git style patch script. Escaping them into octal just obfuscates the user's intent, with no gain. When parsing an escaped octal sequence, we must parse no more than 3 digits. That is, "\1002" is actually "@2", not the Unicode character \u0202. Change-Id: I3a849a0d318e69b654f03fd559f5d7f99dd63e5c Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java
index 7e5bde7582..f920af6116 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java
@@ -222,14 +222,24 @@ public abstract class QuotedString {
for (int i = 'A'; i <= 'Z'; i++)
quote[i] = 0;
quote[' '] = 0;
+ quote['$'] = 0;
+ quote['%'] = 0;
+ quote['&'] = 0;
+ quote['*'] = 0;
quote['+'] = 0;
quote[','] = 0;
quote['-'] = 0;
quote['.'] = 0;
quote['/'] = 0;
+ quote[':'] = 0;
+ quote[';'] = 0;
quote['='] = 0;
+ quote['?'] = 0;
+ quote['@'] = 0;
quote['_'] = 0;
quote['^'] = 0;
+ quote['|'] = 0;
+ quote['~'] = 0;
quote['\u0007'] = 'a';
quote['\b'] = 'b';
@@ -335,7 +345,7 @@ public abstract class QuotedString {
case '2':
case '3': {
int cp = in[inPtr - 1] - '0';
- while (inPtr < inEnd) {
+ for (int n = 1; n < 3 && inPtr < inEnd; n++) {
final byte c = in[inPtr];
if ('0' <= c && c <= '7') {
cp <<= 3;