git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fix urlencode format string on signed char.

From
JDJulien Dusser <julien.dusser@free.fr>
Date
Dec 22, 2017, 17:24 UTC
Message-ID
<20171222172437.19505-1-julien.dusser@free.fr>

Git credential fails with special char in password. remote: Invalid username or password. fatal: Authentication failed for

File ~/.git-credential contains badly urlencoded characters %ffffffXX%ffffffYY instead of %XX%YY.

Add a cast to an unsigned char to fix urlencode use of %02x on a char.

Signed-off-by: Julien Dusser <julien.dusser@free.fr>
---
 strbuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/strbuf.c b/strbuf.c
index 323c49ceb..4d5a9ce55 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -658,7 +658,7 @@ static void strbuf_add_urlencode(struct strbuf *sb, const char *s, size_t len,
 		    (!reserved && is_rfc3986_reserved(ch)))
 			strbuf_addch(sb, ch);
 		else
-			strbuf_addf(sb, "%%%02x", ch);
+			strbuf_addf(sb, "%%%02x", (unsigned char)ch);
 	}
 }
 
-- 
2.15.1
Next: Junio C Hamano
Message 1 of 4 in “Fix urlencode format string on signed char.”
  1. Fix urlencode format string on signed char.Julien Dusser, Dec 22, 2017
  2. Junio C HamanoDec 22, 2017
  3. Julien DusserDec 22, 2017
  4. Johannes SchindelinDec 23, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.