From: Johannes Berg <johannes@sipsolutions.net>
To: Ben Greear <greearb@candelatech.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [WT PATCH 6/6] mac80211: Tell user why beacons fail to parse.
Date: Thu, 11 Jul 2013 17:17:29 +0200 [thread overview]
Message-ID: <1373555849.8201.13.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <51DECAFD.8070608@candelatech.com>
On Thu, 2013-07-11 at 08:10 -0700, Ben Greear wrote:
> >> /* Keep track of what bits of information we have valid info for. */
> >> u8 valid_data;
> >> + char corrupt_elems_msg[80];
> >
> > you should store a "what's bad" type field and the broken IE number or
> > so, to reduce memory usage
>
> I thought of this, but the problem is then you cannot tell the details
> (for instance the actual lengths when length is bad, the ID that is duplicated, etc).
> I figure if we are going to provide the info to the user, we might as well
> be specific about it.
It doesn't seem so difficult?
enum ies_parse_error {
NO_ERROR,
BAD_IE_LEN, // uses eid+len
DUPLICATE_IE, // uses eid
...
} parse_error;
int parse_error_eid, parse_error_len;
> >> + snprintf(elems->parse_err_msg,
> >> + sizeof(elems->parse_err_msg),
> >> + "seen id: %i already", id);
> >
> > Your snprintf() usage is also unsafe.
>
> What is unsafe about it?
using printk("%s", result) is unsafe due to potentially missing
NUL-termination.
johannes
next prev parent reply other threads:[~2013-07-11 15:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-29 22:58 [WT PATCH 1/6] mac80211: Add debugfs file to show station-hash counts greearb
2013-06-29 22:58 ` [WT PATCH 2/6] mac80211: Make un-found-rate splat a warn-once greearb
2013-07-11 8:52 ` Johannes Berg
2013-06-29 22:58 ` [WT PATCH 3/6] wireless: Add memory usage debugging greearb
2013-07-11 8:53 ` Johannes Berg
2013-06-29 22:58 ` [WT PATCH 4/6] mac80211: Add per-sdata station hash, and sdata hash greearb
2013-07-11 8:55 ` Johannes Berg
2013-07-11 15:29 ` Ben Greear
2013-07-26 8:53 ` Johannes Berg
2013-07-26 9:56 ` Felix Fietkau
2013-07-26 15:22 ` Ben Greear
2013-07-26 15:38 ` Felix Fietkau
2013-07-26 16:09 ` Ben Greear
2013-07-26 17:59 ` Felix Fietkau
2013-07-26 15:27 ` Ben Greear
2013-06-29 22:58 ` [WT PATCH 5/6] mac80211: Add debugfs for sdata and sdata->sta_vhash greearb
2013-06-29 22:58 ` [WT PATCH 6/6] mac80211: Tell user why beacons fail to parse greearb
2013-07-11 8:59 ` Johannes Berg
2013-07-11 15:10 ` Ben Greear
2013-07-11 15:17 ` Johannes Berg [this message]
2013-07-11 8:51 ` [WT PATCH 1/6] mac80211: Add debugfs file to show station-hash counts 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=1373555849.8201.13.camel@jlt4.sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=greearb@candelatech.com \
--cc=linux-wireless@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).