lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 23 Mar 2007 16:02:05 +0100
From:	Johannes Berg <johannes@...solutions.net>
To:	"David S. Miller" <davem@...emloft.net>
Cc:	Thomas Graf <tgraf@...g.ch>, netdev <netdev@...r.kernel.org>
Subject: [PATCH] netlink: introduce NLA_BINARY type

This patch introduces a new NLA_BINARY attribute policy type with the
verification of simply checking the maximum length of the payload.

It also fixes a small typo in the example.

Signed-off-by: Johannes Berg <johannes@...solutions.net>
Cc: Thomas Graf <tgraf@...g.ch>
Cc: netdev@...r.kernel.org

---
 include/net/netlink.h |    4 +++-
 net/netlink/attr.c    |    5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

--- linux-2.6.orig/include/net/netlink.h	2007-03-23 15:45:52.932598534 +0100
+++ linux-2.6/include/net/netlink.h	2007-03-23 15:46:25.962598534 +0100
@@ -171,6 +171,7 @@ enum {
 	NLA_MSECS,
 	NLA_NESTED,
 	NLA_NUL_STRING,
+	NLA_BINARY,
 	__NLA_TYPE_MAX,
 };
 
@@ -188,12 +189,13 @@ enum {
  *    NLA_STRING           Maximum length of string
  *    NLA_NUL_STRING       Maximum length of string (excluding NUL)
  *    NLA_FLAG             Unused
+ *    NLA_BINARY           Maximum length of attribute payload
  *    All other            Exact length of attribute payload
  *
  * Example:
  * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = {
  * 	[ATTR_FOO] = { .type = NLA_U16 },
- *	[ATTR_BAR] = { .type = NLA_STRING, len = BARSIZ },
+ *	[ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ },
  *	[ATTR_BAZ] = { .len = sizeof(struct mystruct) },
  * };
  */
--- linux-2.6.orig/net/netlink/attr.c	2007-03-23 15:46:53.112598534 +0100
+++ linux-2.6/net/netlink/attr.c	2007-03-23 15:48:12.902598534 +0100
@@ -67,6 +67,11 @@ static int validate_nla(struct nlattr *n
 		}
 		break;
 
+	case NLA_BINARY:
+		if (pt->len && attrlen > pt->len)
+			return -ERANGE;
+		break;
+
 	default:
 		if (pt->len)
 			minlen = pt->len;


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ