From c2015b3ae0d52ccae33ee00c2b25b8402c66bdf0 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sun, 4 Nov 2007 21:26:22 +0100 Subject: [PATCH] Fix an infinite loop in sq_quote_buf(). sq_quote_buf() treats single-quotes and exclamation marks specially, but it incorrectly parsed the input for single-quotes and backslashes. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- quote.c | 2 +- t/t5510-fetch.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/quote.c b/quote.c index 482be05b7..919d0920a 100644 --- a/quote.c +++ b/quote.c @@ -26,7 +26,7 @@ void sq_quote_buf(struct strbuf *dst, const char *src) strbuf_addch(dst, '\''); while (*src) { - size_t len = strcspn(src, "'\\"); + size_t len = strcspn(src, "'!"); strbuf_add(dst, src, len); src += len; while (need_bs_quote(*src)) { diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index d21765714..aad863db7 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -208,4 +208,11 @@ test_expect_success 'fetch with a non-applying branch..merge' ' git fetch blub ' +# the strange name is: a\!'b +test_expect_success 'quoting of a strangely named repo' ' + ! git fetch "a\\!'\''b" > result 2>&1 && + cat result && + grep "fatal: '\''a\\\\!'\''b'\''" result +' + test_done -- 2.26.2