]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Check for trailing input garbage in tor_compress_impl() when decompressing
authorteor <teor2345@gmail.com>
Thu, 15 Jun 2017 23:41:29 +0000 (09:41 +1000)
committerteor <teor2345@gmail.com>
Thu, 15 Jun 2017 23:41:29 +0000 (09:41 +1000)
Fixes #22629.

src/common/compress.c

index 92b64d1e9188d5a77304902a92e23fb6c23b2a87..ee9de6a768ff37a73d94704a6b73b39f570c3dd2 100644 (file)
@@ -139,7 +139,15 @@ tor_compress_impl(int compress,
         if (compress || complete_only) {
           goto err;
         } else {
-          goto done;
+          if (in_len != 0) {
+            log_fn(protocol_warn_level, LD_PROTOCOL,
+                   "Unexpected extra input while decompressing");
+            log_debug(LD_GENERAL, "method: %d level: %d at len: %zd",
+                      method, compression_level, in_len);
+            goto err;
+          } else {
+            goto done;
+          }
         }
         break;
       case TOR_COMPRESS_BUFFER_FULL: {