path: root/credential-store.c
diff options
authorCarlo Marcelo Arenas Belón <>2020-05-02 22:34:47 (GMT)
committerJunio C Hamano <>2020-05-03 01:10:38 (GMT)
commitc03859a66525c6bdc5cd3c02b31f06cfdd80b595 (patch)
tree350a3dc97b28e87a7f34bc961997193263abf6b8 /credential-store.c
parent20b4964fdf43491494122fbd297b2da7d66663b2 (diff)
credential-store: ignore bogus lines from store file
With the added checks for invalid URLs in credentials, any locally modified store files which might have empty lines or even comments were reported[1] failing to parse as valid credentials. Instead of doing a hard check for credentials, do a soft one and therefore avoid the reported fatal error. While at it add tests for all known corruptions that are currently ignored to keep track of them and avoid the risk of regressions. [1] Reported-by: Dirk <> Helped-by: Eric Sunshine <> Helped-by: Junio C Hamano <> Based-on-patch-by: Jonathan Nieder <> Signed-off-by: Carlo Marcelo Arenas Belón <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'credential-store.c')
1 files changed, 2 insertions, 2 deletions
diff --git a/credential-store.c b/credential-store.c
index ac29542..68c02fb 100644
--- a/credential-store.c
+++ b/credential-store.c
@@ -24,8 +24,8 @@ static int parse_credential_file(const char *fn,
while (strbuf_getline_lf(&line, fh) != EOF) {
- credential_from_url(&entry, line.buf);
- if (entry.username && entry.password &&
+ if (!credential_from_url_gently(&entry, line.buf, 1) &&
+ entry.username && entry.password &&
credential_match(c, &entry)) {
found_credential = 1;
if (match_cb) {