mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 15:10:48 +01:00
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.
This commit is contained in:
parent
480dab4f2f
commit
e5122b91a9
1 changed files with 2 additions and 2 deletions
|
@ -255,8 +255,8 @@ detect_compression_method(const char *in, size_t in_len)
|
||||||
} else if (in_len > 2 && (in[0] & 0x0f) == 8 &&
|
} else if (in_len > 2 && (in[0] & 0x0f) == 8 &&
|
||||||
(ntohs(get_uint16(in)) % 31) == 0) {
|
(ntohs(get_uint16(in)) % 31) == 0) {
|
||||||
return ZLIB_METHOD;
|
return ZLIB_METHOD;
|
||||||
} else if (in_len > 3 &&
|
} else if (in_len > 2 &&
|
||||||
fast_memeq(in, "\x5d\x00\x00\x00", 4)) {
|
fast_memeq(in, "\x5d\x00\x00", 3)) {
|
||||||
return LZMA_METHOD;
|
return LZMA_METHOD;
|
||||||
} else if (in_len > 3 &&
|
} else if (in_len > 3 &&
|
||||||
fast_memeq(in, "\x28\xb5\x2f\xfd", 4)) {
|
fast_memeq(in, "\x28\xb5\x2f\xfd", 4)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue