[Bug 890] Bug in ulogd_filter_IP2BIN

bugzilla-daemon at netfilter.org bugzilla-daemon at netfilter.org
Wed May 14 19:49:43 CEST 2014


https://bugzilla.netfilter.org/show_bug.cgi?id=890

Bart Mermuys <bmermuys at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bmermuys at hotmail.com

--- Comment #1 from Bart Mermuys <bmermuys at hotmail.com> 2014-05-14 19:49:41 CEST ---

The bug is larger than mentioned by the original poster.

1) It applies to IP2BIN but also to HWHDR, IP2HBIN and IP2STR.

2) In some files it's a for condition that's wrong but in some it's (also) an
incorrectly sized array.


===
Signed-off-by: Bart Mermuys <bart.mermuys at gmail.com>

---
 filter/ulogd_filter_HWHDR.c   |    2 +-
 filter/ulogd_filter_IP2BIN.c  |    4 ++--
 filter/ulogd_filter_IP2HBIN.c |    2 +-
 filter/ulogd_filter_IP2STR.c  |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/filter/ulogd_filter_HWHDR.c b/filter/ulogd_filter_HWHDR.c
index 3b095c9..749bc50 100644
--- a/filter/ulogd_filter_HWHDR.c
+++ b/filter/ulogd_filter_HWHDR.c
@@ -109,7 +109,7 @@ static struct ulogd_key mac2str_keys[] = {
     },
 };

-static char hwmac_str[MAX_KEY - START_KEY][HWADDR_LENGTH];
+static char hwmac_str[MAX_KEY - START_KEY+1][HWADDR_LENGTH];

 static int parse_mac2str(struct ulogd_key *ret, unsigned char *mac,
              int okey, int len)
diff --git a/filter/ulogd_filter_IP2BIN.c b/filter/ulogd_filter_IP2BIN.c
index e47eeaf..95db8b0 100644
--- a/filter/ulogd_filter_IP2BIN.c
+++ b/filter/ulogd_filter_IP2BIN.c
@@ -114,7 +114,7 @@ static struct ulogd_key ip2bin_keys[] = {

 };

-static char ipbin_array[MAX_KEY-START_KEY][IPADDR_LENGTH];
+static char ipbin_array[MAX_KEY-START_KEY+1][IPADDR_LENGTH];

 /**
  * Convert IPv4 address (as 32-bit unsigned integer) to IPv6 address:
@@ -205,7 +205,7 @@ static int interp_ip2bin(struct ulogd_pluginstance *pi)
     int fret;

     /* Iter on all addr fields */
-    for(i = START_KEY; i < MAX_KEY; i++) {
+    for(i = START_KEY; i <= MAX_KEY; i++) {
         if (pp_is_valid(inp, i)) {
             fret = ip2bin(inp, i, i-START_KEY);
             if (fret != ULOGD_IRET_OK)
diff --git a/filter/ulogd_filter_IP2HBIN.c b/filter/ulogd_filter_IP2HBIN.c
index 4fd3ff1..564424f 100644
--- a/filter/ulogd_filter_IP2HBIN.c
+++ b/filter/ulogd_filter_IP2HBIN.c
@@ -153,7 +153,7 @@ static int interp_ip2hbin(struct ulogd_pluginstance *pi)
     }

     /* Iter on all addr fields */
-    for(i = START_KEY; i < MAX_KEY; i++) {
+    for(i = START_KEY; i <= MAX_KEY; i++) {
         if (pp_is_valid(inp, i)) {
             switch (convfamily) {
             case AF_INET:
diff --git a/filter/ulogd_filter_IP2STR.c b/filter/ulogd_filter_IP2STR.c
index 732e1ef..5880a2c 100644
--- a/filter/ulogd_filter_IP2STR.c
+++ b/filter/ulogd_filter_IP2STR.c
@@ -137,7 +137,7 @@ static struct ulogd_key ip2str_keys[] = {
     },
 };

-static char ipstr_array[MAX_KEY-START_KEY][IPADDR_LENGTH];
+static char ipstr_array[MAX_KEY-START_KEY+1][IPADDR_LENGTH];

 static int ip2str(struct ulogd_key *inp, int index, int oindex)
 {
-- 
1.7.9.5

-- 
Configure bugmail: https://bugzilla.netfilter.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the netfilter-buglog mailing list