diff options
author | Alexander Færøy <ahf@torproject.org> | 2017-04-27 20:07:08 +0200 |
---|---|---|
committer | Alexander Færøy <ahf@torproject.org> | 2017-04-27 20:07:08 +0200 |
commit | e5122b91a951d44702b11a70862ec99e851a2578 (patch) | |
tree | a55dc2bfac9866e5c990adf369dc7c6ffa4851d9 /src/common/compress.c | |
parent | 480dab4f2f8de6661c71e71f37d4a824ecf38e3c (diff) | |
download | tor-e5122b91a951d44702b11a70862ec99e851a2578.tar.gz tor-e5122b91a951d44702b11a70862ec99e851a2578.zip |
Only compare the first 3 bytes when trying to detect LZMA compression.
This patch changes the logic in `detect_compression_method()` to only
use the 3 first bytes when checking if a given input is LZMA encoded.
Diffstat (limited to 'src/common/compress.c')
-rw-r--r-- | src/common/compress.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/compress.c b/src/common/compress.c index 8502dee25c..738df9f185 100644 --- a/src/common/compress.c +++ b/src/common/compress.c @@ -255,8 +255,8 @@ detect_compression_method(const char *in, size_t in_len) } else if (in_len > 2 && (in[0] & 0x0f) == 8 && (ntohs(get_uint16(in)) % 31) == 0) { return ZLIB_METHOD; - } else if (in_len > 3 && - fast_memeq(in, "\x5d\x00\x00\x00", 4)) { + } else if (in_len > 2 && + fast_memeq(in, "\x5d\x00\x00", 3)) { return LZMA_METHOD; } else if (in_len > 3 && fast_memeq(in, "\x28\xb5\x2f\xfd", 4)) { |