[tor-commits] [tor/master] Use tor_ntohs in compress.c; avoid a winsocks dependency

nickm at torproject.org nickm at torproject.org
Thu Jun 28 19:21:00 UTC 2018


commit 7d7af19f1b282554df5117c5c963736d0253a8d5
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Jun 28 13:39:49 2018 -0400

    Use tor_ntohs in compress.c; avoid a winsocks dependency
---
 src/lib/compress/compress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/compress/compress.c b/src/lib/compress/compress.c
index 23a5c0304..2cb5dbaec 100644
--- a/src/lib/compress/compress.c
+++ b/src/lib/compress/compress.c
@@ -281,7 +281,7 @@ detect_compression_method(const char *in, size_t in_len)
   if (in_len > 2 && fast_memeq(in, "\x1f\x8b", 2)) {
     return GZIP_METHOD;
   } else if (in_len > 2 && (in[0] & 0x0f) == 8 &&
-             (ntohs(get_uint16(in)) % 31) == 0) {
+             (tor_ntohs(get_uint16(in)) % 31) == 0) {
     return ZLIB_METHOD;
   } else if (in_len > 2 &&
              fast_memeq(in, "\x5d\x00\x00", 3)) {





More information about the tor-commits mailing list