From: Ingo Oeser <netdev@axxeo.de>
To: jt@hpl.hp.com
Cc: "John W. Linville" <linville@tuxdriver.com>,
netdev@vger.kernel.org, Johannes Berg <johannes@sipsolutions.net>,
Jouni Malinen <jkm@devicescape.com>
Subject: Re: [PATCH 2.6] WE-22 : prevent information leak on 64 bit
Date: Tue, 27 Mar 2007 15:24:29 +0200 [thread overview]
Message-ID: <200703271524.30326.netdev@axxeo.de> (raw)
In-Reply-To: <20070323003116.GC2712@bougret.hpl.hp.com>
Hi,
Jean Tourrilhes schrieb:
> diff -u -p linux/include/net/iw_handler.j1.h linux/include/net/iw_handler.h
> --- linux/include/net/iw_handler.j1.h 2007-03-16 17:36:22.000000000 -0700
> +++ linux/include/net/iw_handler.h 2007-03-21 11:01:09.000000000 -0700
> @@ -500,7 +504,11 @@ iwe_stream_add_event(char * stream, /*
> /* Check if it's possible */
> if(likely((stream + event_len) < ends)) {
> iwe->len = event_len;
> - memcpy(stream, (char *) iwe, event_len);
> + /* Beware of alignement issues on 64 bits */
> + memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
useless cast (void* and char* are already compatible).
You just need to cast to "char *", if you like to add an byte offset.
If not, just don't cast.
> + memcpy(stream + IW_EV_LCP_LEN,
> + ((char *) iwe) + IW_EV_LCP_LEN,
> + event_len - IW_EV_LCP_LEN);
> stream += event_len;
Can this be a helper like "stream = copy_to_stream(stream, iwe, len);" ?
Or do the offsets in stream and iwe vary too much for this?
> }
> return stream;
> @@ -521,10 +529,10 @@ iwe_stream_add_point(char * stream, /*
> /* Check if it's possible */
> if(likely((stream + event_len) < ends)) {
> iwe->len = event_len;
> - memcpy(stream, (char *) iwe, IW_EV_LCP_LEN);
> + memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
useless cast.
> memcpy(stream + IW_EV_LCP_LEN,
> ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
> - IW_EV_POINT_LEN - IW_EV_LCP_LEN);
> + IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
> memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);
> stream += event_len;
> }
> @@ -574,7 +582,11 @@ iwe_stream_check_add_event(char * stream
> /* Check if it's possible, set error if not */
> if(likely((stream + event_len) < ends)) {
> iwe->len = event_len;
> - memcpy(stream, (char *) iwe, event_len);
> + /* Beware of alignement issues on 64 bits */
> + memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
useless cast.
> + memcpy(stream + IW_EV_LCP_LEN,
> + ((char *) iwe) + IW_EV_LCP_LEN,
> + event_len - IW_EV_LCP_LEN);
> stream += event_len;
> } else
> *perr = -E2BIG;
> @@ -598,10 +610,10 @@ iwe_stream_check_add_point(char * stream
> /* Check if it's possible */
> if(likely((stream + event_len) < ends)) {
> iwe->len = event_len;
> - memcpy(stream, (char *) iwe, IW_EV_LCP_LEN);
> + memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
useless cast.
> memcpy(stream + IW_EV_LCP_LEN,
> ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
> - IW_EV_POINT_LEN - IW_EV_LCP_LEN);
> + IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
> memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);
> stream += event_len;
> } else
Regards
Ingo Oeser
next prev parent reply other threads:[~2007-03-27 13:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-23 0:31 [PATCH 2.6] WE-22 : prevent information leak on 64 bit Jean Tourrilhes
2007-03-27 13:24 ` Ingo Oeser [this message]
[not found] ` <1175508410.23438.75.camel@johannes.berg>
[not found] ` <1175508410.23438.75.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2007-04-17 17:08 ` Jean Tourrilhes
[not found] ` <20070417170820.GB22372-yAE0UhLNZJawPNPzzlOzwdBPR1lH4CV8@public.gmane.org>
2007-04-17 18:34 ` John W. Linville
2007-04-17 21:19 ` Jean Tourrilhes
[not found] ` <20070417211859.GB22897-yAE0UhLNZJawPNPzzlOzwdBPR1lH4CV8@public.gmane.org>
2007-04-17 21:59 ` Roland Dreier
2007-04-17 23:34 ` Michael Buesch
[not found] ` <200704180134.50571.mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org>
2007-04-18 16:30 ` Jean Tourrilhes
2007-04-18 10:18 ` 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=200703271524.30326.netdev@axxeo.de \
--to=netdev@axxeo.de \
--cc=jkm@devicescape.com \
--cc=johannes@sipsolutions.net \
--cc=jt@hpl.hp.com \
--cc=linville@tuxdriver.com \
--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).