]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
range: move back files ownership in one case
authorPhilippe Antoine <contact@catenacyber.fr>
Thu, 14 Oct 2021 19:31:13 +0000 (21:31 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 15 Oct 2021 06:10:52 +0000 (08:10 +0200)
In the case, we receive a range request with expected
overlap then new bytes, but the response does not get to the
new bytes, we are still skipping, but the HttpRangeContainerBlock
had the ownership of the files, and need to give it back

src/app-layer-htp-range.c

index 2e4e628d3e73ebf8f3d2efdb581a1b05ab4aae4b..24777d3f99b3df44fb0aa654d23c755aa4d83b96 100644 (file)
@@ -506,6 +506,11 @@ File *HttpRangeClose(HttpRangeContainerBlock *c, uint16_t flags)
     } else if (c->toskip > 0) {
         // was only an overlapping range, truncated before new bytes
         SCLogDebug("c->toskip %" PRIu64, c->toskip);
+        if (c->files) {
+            // if we expected new bytes after overlap
+            c->container->files = c->files;
+            c->files = NULL;
+        }
         return NULL;
     } else {
         // we just finished an in-order block