Skip to content

Commit 4c267f2

Browse files
j-d-rgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3013dff commit 4c267f2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

strbuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ static void strbuf_add_urlencode(struct strbuf *sb, const char *s, size_t len,
658658
(!reserved && is_rfc3986_reserved(ch)))
659659
strbuf_addch(sb, ch);
660660
else
661-
strbuf_addf(sb, "%%%02x", ch);
661+
strbuf_addf(sb, "%%%02x", (unsigned char)ch);
662662
}
663663
}
664664

0 commit comments

Comments
 (0)