summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Habouzit <madcoder@debian.org>2008-03-06 21:28:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-03-07 21:31:30 (GMT)
commitc8744d6a8b27115503565041566d97c21e722584 (patch)
treec070c6bef6f1bc5e1eb3fb4e6f952cfe097f6cdf
parentc2116a1783a3d555d41892ae7db0dd0934d4ddf1 (diff)
downloadgit-c8744d6a8b27115503565041566d97c21e722584.zip
git-c8744d6a8b27115503565041566d97c21e722584.tar.gz
git-c8744d6a8b27115503565041566d97c21e722584.tar.bz2
unquote_c_style: fix off-by-one.
The optional endp parameter to unquote_c_style() was supposed to point at a location past the closing double quote, but it was going one beyond it. git-fast-import used this function heavily and the bug caused it to misparse the input stream, especially when parsing a rename command: R "filename that needs quoting" rename-target-name Because the function erroneously ate the whitespace after the closing dq, this triggered "Missing space after source" error when it shouldn't. Thanks to Adeodato Simò for having caught this. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--quote.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/quote.c b/quote.c
index d061626..40702f6 100644
--- a/quote.c
+++ b/quote.c
@@ -288,7 +288,7 @@ int unquote_c_style(struct strbuf *sb, const char *quoted, const char **endp)
switch (*quoted++) {
case '"':
if (endp)
- *endp = quoted + 1;
+ *endp = quoted;
return 0;
case '\\':
break;