diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-03-21 15:03:25 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-21 15:03:25 -0700 |
commit | 36238fc4a59ae03e5574510dec3751745f98e940 (patch) | |
tree | 6af7e8a0fceb89a9f8a155bf4ce57129def05f0d /http-walker.c | |
parent | Merge branch 'mg/status-porcelain-no-i18n' into maint (diff) | |
parent | http-walker: fix buffer underflow processing remote alternates (diff) | |
download | tgif-36238fc4a59ae03e5574510dec3751745f98e940.tar.xz |
Merge branch 'jk/http-walker-buffer-underflow-fix' into maint
"Dumb http" transport used to misparse a nonsense http-alternates
response, which has been fixed.
* jk/http-walker-buffer-underflow-fix:
http-walker: fix buffer underflow processing remote alternates
Diffstat (limited to 'http-walker.c')
-rw-r--r-- | http-walker.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/http-walker.c b/http-walker.c index b34b6ace7c..507c200f00 100644 --- a/http-walker.c +++ b/http-walker.c @@ -296,13 +296,16 @@ static void process_alternates_response(void *callback_data) okay = 1; } } - /* skip "objects\n" at end */ if (okay) { struct strbuf target = STRBUF_INIT; strbuf_add(&target, base, serverlen); - strbuf_add(&target, data + i, posn - i - 7); - - if (is_alternate_allowed(target.buf)) { + strbuf_add(&target, data + i, posn - i); + if (!strbuf_strip_suffix(&target, "objects")) { + warning("ignoring alternate that does" + " not end in 'objects': %s", + target.buf); + strbuf_release(&target); + } else if (is_alternate_allowed(target.buf)) { warning("adding alternate object store: %s", target.buf); newalt = xmalloc(sizeof(*newalt)); |