From c8744d6a8b27115503565041566d97c21e722584 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Thu, 6 Mar 2008 22:28:19 +0100 Subject: [PATCH] unquote_c_style: fix off-by-one. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- quote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quote.c b/quote.c index d061626c3..40702f6b7 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; -- 2.30.2