From: Paul Moore <[EMAIL PROTECTED]>

The CIPSOv4 translated tag #1 mapping does not always return the correct error
code if the desired mapping does not exist; instead of returning -EPERM it
returns -ENOSPC indicating that the buffer is not large enough to hold the
translated value.  This was caused by failing to check a specific error
condition.  This patch fixes this so that unknown mappings return
-EPERM which is consistent with the rest of the related CIPSOv4 code.

Signed-off-by: Paul Moore <[EMAIL PROTECTED]>
---
 net/ipv4/cipso_ipv4.c |    4 ++++
 1 files changed, 4 insertions(+)

Index: net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
===================================================================
--- net-2.6.20_netlabel-base-work.orig/net/ipv4/cipso_ipv4.c
+++ net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
@@ -868,6 +868,8 @@ static int cipso_v4_map_cat_rbm_hton(con
                                return -EPERM;
 
                        net_spot = host_cat_array[host_spot];
+                       if (net_spot >= CIPSO_V4_INV_CAT)
+                               return -EPERM;
                        if (net_spot >= net_clen_bits)
                                return -ENOSPC;
                        cipso_v4_bitmap_setbit(net_cat, net_spot, 1);
@@ -936,6 +938,8 @@ static int cipso_v4_map_cat_rbm_ntoh(con
                                return -EPERM;
 
                        host_spot = net_cat_array[net_spot];
+                       if (host_spot >= CIPSO_V4_INV_CAT)
+                               return -EPERM;
                        if (host_spot >= host_clen_bits)
                                return -ENOSPC;
                        cipso_v4_bitmap_setbit(host_cat, host_spot, 1);

--
paul moore
linux security @ hp
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to