]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
defrag: do not cast pkt len to u16
authorPhilippe Antoine <pantoine@oisf.net>
Wed, 8 Jun 2022 15:02:41 +0000 (17:02 +0200)
committerVictor Julien <vjulien@oisf.net>
Thu, 9 Jun 2022 05:27:16 +0000 (07:27 +0200)
as it can overflow

src/defrag.c

index 1bd34b5152187f9f842e81115d67f2300ee96144..992d0205c262f24d6e9dd19db0ffa529cbaf2877 100644 (file)
@@ -840,8 +840,7 @@ DefragInsertFrag(ThreadVars *tv, DecodeThreadVars *dtv, DefragTracker *tracker,
         goto done;
     }
     memcpy(new->pkt, GET_PKT_DATA(p) + ltrim, GET_PKT_LEN(p) - ltrim);
-    DEBUG_VALIDATE_BUG_ON(GET_PKT_LEN(p) - ltrim > UINT16_MAX);
-    new->len = (uint16_t)(GET_PKT_LEN(p) - ltrim);
+    new->len = (GET_PKT_LEN(p) - ltrim);
     /* in case of unfragmentable exthdrs, update the 'next hdr' field
      * in the raw buffer so the reassembled packet will point to the
      * correct next header after stripping the frag header */