]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
radix-tree - prevent out of bounds array access
authorJason Ish <ish@unx.ca>
Mon, 11 May 2015 16:20:25 +0000 (10:20 -0600)
committerVictor Julien <victor@inliniac.net>
Tue, 19 May 2015 15:35:36 +0000 (17:35 +0200)
An IPv6 entry specified before an IPv4 entry on the host-os-policy
table can cause the stream byte array to be access one byte after
the end of the allocated memory at util-radix-tree.c:578.

src/util-radix-tree.c

index 39f8304ef907e4fe97d3cc9592ebf18dc1642636..cbf49c7de7cbfacd9b0d6dbd415460c04e81912b 100644 (file)
@@ -570,7 +570,7 @@ static SCRadixNode *SCRadixAddKey(uint8_t *key_stream, uint16_t key_bitlen,
          * down along one of the paths, since either paths should end up with a
          * node that has a common prefix whose differ bit is greater than the
          * bitlen of the incoming prefix */
-        if (bitlen < node->bit) {
+        if (bitlen <= node->bit) {
             if (node->right == NULL)
                 break;
             node = node->right;