From: Thomas Graf <tgraf@suug.ch>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: [RFC] remove NLA_STRING NUL trimming
Date: Fri, 23 Mar 2007 15:20:46 +0100 [thread overview]
Message-ID: <20070323142046.GC521@postel.suug.ch> (raw)
In-Reply-To: <1174605138.3588.54.camel@johannes.berg>
* Johannes Berg <johannes@sipsolutions.net> 2007-03-23 00:12
> 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.
It's not really removed, the trailing NUL is just ignored when checking
the length of the attribute. This is needed for older netlink families
where strings are not always NUL terminated, yet we still need to accept
the additional byte needed in case it is present. This validation is
strictly necessary, otherwise nla_strcmp() and others will fail.
> 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.
I suggest that you introduce NLA_BINARY which enforces a maximum length.
next prev parent reply other threads:[~2007-03-23 14:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-22 23:12 [RFC] remove NLA_STRING NUL trimming Johannes Berg
2007-03-23 14:20 ` Thomas Graf [this message]
2007-03-23 14:40 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070323142046.GC521@postel.suug.ch \
--to=tgraf@suug.ch \
--cc=johannes@sipsolutions.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).