Skip to contentSkip to conversation

unquote_c_style: fix off-by-one.

PATCH In review Pierre Habouzit 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 unquote_c_style: fix off-by-one.

Thanks to Adeodato Simò for having caught this.

---
 quote.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
quote.c +1 -1
index d061626..40702f6 100644
@@ -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;
Signature · 1 line
1.5.4.3.593.g07854
#1 lore raw
Quoted 3 lines · Pierre Habouzit

Thanks to Adeodato Simò for having caught this.

Thanks. I would have appreciated a comment that said something about what external breakages this one caused, so that we can have an entry in "bugs fixed" list.

A quick audit of the existing callers suggests that it is fast-import.

#2 lore raw
Quoted 11 lines · Junio C Hamano
Quoted 3 lines · Pierre Habouzit

Thanks to Adeodato Simò for having caught this.

Thanks. I would have appreciated a comment that said something about what external breakages this one caused, so that we can have an entry in "bugs fixed" list.

A quick audit of the existing callers suggests that it is fast-import.

I actually don't really know, Adeodato asked me to look into it
because I was the last that touched it, you have to ask him why he found this :)

I Cc'd him.

Signature · 3 lines
·O·  Pierre Habouzit
··O                                                [email protected]
OOO                                                http://www.madism.org
#3 lore raw
Quoted 5 lines · Pierre Habouzit
Quoted 3 lines · Junio C Hamano
Quoted 1 line · Pierre Habouzit

Thanks to Adeodato Simò for having caught this.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Thanks. I would have appreciated a comment that said something about what external breakages this one caused, so that we can have an entry in "bugs fixed" list.

A quick audit of the existing callers suggests that it is fast-import.

Yes, it's fast-import. In particular, trying to rename a file whose name contains spaces:

R "file 1.txt" file 2.txt
^
unquote_c_style() eats that space, thus fast-import fails with:

fatal: Missing space after source: R "file 1.txt" file 2.txt

Cheers,

Signature · 9 lines
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
- In Italy, for 30 years under the Borgias they had warfare, terror,
  murder, bloodshed, but they produced Michelangelo, Leonardo da Vinci,
  and the Renaissance. In Switzerland they had brotherly love - they had
  500 years of democracy and peace, and what did that produce? The
  cuckoo clock.
                -- Harry Lime in “The Third Man”
#4 lore raw
Quoted 18 lines · Adeodato Simó
Quoted 5 lines · Pierre Habouzit
Quoted 3 lines · Junio C Hamano
Quoted 1 line · Pierre Habouzit

Thanks to Adeodato Simò for having caught this.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Thanks. I would have appreciated a comment that said something about what external breakages this one caused, so that we can have an entry in "bugs fixed" list.

A quick audit of the existing callers suggests that it is fast-import.

Yes, it's fast-import. In particular, trying to rename a file whose name contains spaces:

Quoted 7 lines

R "file 1.txt" file 2.txt
^
unquote_c_style() eats that space, thus fast-import fails with:

fatal: Missing space after source: R "file 1.txt" file 2.txt

Thanks.