diff options
author | Nelson Elhage <nelhage@nelhage.com> | 2018-06-28 05:27:36 +0000 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2018-10-01 12:08:49 +0200 |
commit | e91024e1adea7f272d8270c0787aeaa3857a2855 (patch) | |
tree | aa47b3e53a84181111832b6040e20beabde4cb0a /src | |
parent | c83c59b82bc5aa26b5387714f26bdabf8e15c3e1 (diff) | |
download | libgit2-e91024e1adea7f272d8270c0787aeaa3857a2855.tar.gz |
Small style tweak, and set an error
(cherry picked from commit 895a668e19dc596e7b12ea27724ceb7b68556106)
Diffstat (limited to 'src')
-rw-r--r-- | src/transports/smart_pkt.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/transports/smart_pkt.c b/src/transports/smart_pkt.c index 23772445c..d4fbd3779 100644 --- a/src/transports/smart_pkt.c +++ b/src/transports/smart_pkt.c @@ -402,7 +402,17 @@ int git_pkt_parse_line( len = parse_len(line); if (len < 0) { - return GIT_ERROR; + /* + * If we fail to parse the length, it might be because the + * server is trying to send us the packfile already. + */ + if (bufflen >= 4 && !git__prefixcmp(line, "PACK")) { + giterr_set(GITERR_NET, "unexpected pack file"); + } else { + giterr_set(GITERR_NET, "bad packet length"); + } + + return -1; } /* |