diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-06-03 20:38:00 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-09-03 13:42:46 -0400 |
commit | 7573e66b9961cdb571c3c7af688fd01912e66455 (patch) | |
tree | 3efbb6e9eddeca031df1883a5b2c2b157b4d68ef /src/common/torgzip.c | |
parent | ad8977e39461807dd04e34dc7fa3c12ccef0b62d (diff) | |
download | tor-7573e66b9961cdb571c3c7af688fd01912e66455.tar.gz tor-7573e66b9961cdb571c3c7af688fd01912e66455.zip |
Treat Z_BUF_ERROR as TOR_ZLIB_BUF_FULL when finalizing a zlib buffer
Otherwise, when we're out of input *and* finalizing, we might report
TOR_ZLIB_OK erroneously and not finalize the buffer.
(I don't believe this can happen in practice, with our code today:
write_to_buf_zlib ensures that we are never trying to write into a
completely empty buffer, and zlib says "Z_OK" if you give it even
one byte to write into.)
Fixes bug 11824; bugfix on 0.1.1.23 (06e09cdd47eaa8f7e90ce2).
Diffstat (limited to 'src/common/torgzip.c')
-rw-r--r-- | src/common/torgzip.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/torgzip.c b/src/common/torgzip.c index 4328c63c8b..778cbe9169 100644 --- a/src/common/torgzip.c +++ b/src/common/torgzip.c @@ -480,7 +480,7 @@ tor_zlib_process(tor_zlib_state_t *state, case Z_STREAM_END: return TOR_ZLIB_DONE; case Z_BUF_ERROR: - if (state->stream.avail_in == 0) + if (state->stream.avail_in == 0 && !finish) return TOR_ZLIB_OK; return TOR_ZLIB_BUF_FULL; case Z_OK: |