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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1174605138.3588.54.camel@johannes.berg>
Date:	Fri, 23 Mar 2007 00:12:18 +0100
From:	Johannes Berg <johannes@...solutions.net>
To:	Thomas Graf <tgraf@...g.ch>
Cc:	netdev <netdev@...r.kernel.org>
Subject: [RFC] remove NLA_STRING NUL trimming

Looking through the netlink/attr.c code I noticed that NLA_STRING
attributes that end with a binary NUL have it removed before passing it
to the consumer.

For wireless, we have a few places where we need to be able to accept
any (even binary) values, for example for the SSID; the SSID can validly
end with \0 and I'd still love to be able to take advantage of
NLA_STRING and .len = 32 so I don't need to check the length myself.
However, given the code above, an SSID with a terminating \0 would be
reduced by one character.

This patch removes the trimming.

Signed-off-by: Johannes Berg <johannes@...solutions.net>

---
This shouldn't break things if all users that rely on terminating NULs
have migrated to NLA_NUL_STRING already. I don't see many users of
NLA_STRING still, but if we can't make that change because some users
still rely on it trimming the NUL I could also make a patch that
introduces NLA_BIN_STRING with the changed semantics.

--- wireless-dev.orig/net/netlink/attr.c	2007-03-23 00:06:41.293435409 +0100
+++ wireless-dev/net/netlink/attr.c	2007-03-23 00:07:13.753435409 +0100
@@ -56,15 +56,8 @@ static int validate_nla(struct nlattr *n
 		if (attrlen < 1)
 			return -ERANGE;
 
-		if (pt->len) {
-			char *buf = nla_data(nla);
-
-			if (buf[attrlen - 1] == '\0')
-				attrlen--;
-
-			if (attrlen > pt->len)
-				return -ERANGE;
-		}
+		if (pt->len && attrlen > pt->len)
+			return -ERANGE;
 		break;
 
 	default:


-
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