diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-10-01 11:16:50 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-10-02 00:06:00 +0200 |
commit | 5848fb11acd0b6aad6ba9e3e71bd91485e0d4c71 (patch) | |
tree | 1a8828ad2e306599bd10a234c2edcb502cce75fc /streaming.c | |
parent | object-file.c: use "enum" return type for unpack_loose_header() (diff) | |
download | git-5848fb11acd0b6aad6ba9e3e71bd91485e0d4c71.tar.xz git-5848fb11acd0b6aad6ba9e3e71bd91485e0d4c71.zip |
object-file.c: return ULHR_TOO_LONG on "header too long"
Split up the return code for "header too long" from the generic
negative return value unpack_loose_header() returns, and report via
error() if we exceed MAX_HEADER_LEN.
As a test added earlier in this series in t1006-cat-file.sh shows
we'll correctly emit zlib errors from zlib.c already in this case, so
we have no need to carry those return codes further down the
stack. Let's instead just return ULHR_TOO_LONG saying we ran into the
MAX_HEADER_LEN limit, or other negative values for "unable to unpack
<OID> header".
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'streaming.c')
-rw-r--r-- | streaming.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/streaming.c b/streaming.c index 6df0247a4c..bd89c50e7b 100644 --- a/streaming.c +++ b/streaming.c @@ -235,6 +235,7 @@ static int open_istream_loose(struct git_istream *st, struct repository *r, case ULHR_OK: break; case ULHR_BAD: + case ULHR_TOO_LONG: goto error; } if (parse_loose_header(st->u.loose.hdr, &oi, 0) < 0) |