From 21777aec41ec829181e9cea50ebf88d8cb47630c Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Thu, 16 Jun 2016 13:31:31 -0300 Subject: [PATCH] Fix invalid memory read in msc_tree --- src/utils/msc_tree.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils/msc_tree.cc b/src/utils/msc_tree.cc index 8a25894b..4e22a3c9 100644 --- a/src/utils/msc_tree.cc +++ b/src/utils/msc_tree.cc @@ -107,7 +107,7 @@ TreePrefix *CPTCreatePrefix(unsigned char *ipdata, unsigned int ip_bitmask, unsigned char netmask) { TreePrefix *prefix = NULL; - int bytes = ip_bitmask/8; + int bytes = ip_bitmask; if ((ip_bitmask % 8 != 0) || (ipdata == NULL)) { return NULL; @@ -759,7 +759,6 @@ TreeNode *CPTFindElement(unsigned char *ipdata, unsigned int ip_bitmask, CPTTree return node; } } - if ((node->prefix->buffer[bytes] & mask) == (temp_data[bytes] & mask)) { if (TreePrefixNetmask(node->prefix, ip_bitmask, TRUE)) { //if (msr && msr->txcfg->debuglog_level >= 9) {