From: Julien Dusser Date: Fri, 22 Dec 2017 17:24:37 +0000 (+0100) Subject: strbuf: fix urlencode format string on signed char X-Git-Tag: v2.16.0-rc1~6^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4c267f2ae37e5b5f834172f04b7dd4343e370689;p=thirdparty%2Fgit.git strbuf: fix urlencode format string on signed char Git credential fails with special char in password with 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 Signed-off-by: Junio C Hamano --- diff --git a/strbuf.c b/strbuf.c index 323c49ceb3..4d5a9ce551 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); } }