From: Matthew Daley <mattjd@gmail.com>
To: netdev@vger.kernel.org
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
Andrew Hendry <andrew.hendry@gmail.com>,
Matthew Daley <mattjd@gmail.com>, stable <stable@kernel.org>
Subject: [PATCH 3/3] x25: Prevent skb overreads when checking call user data
Date: Sat, 15 Oct 2011 00:45:05 -0400 [thread overview]
Message-ID: <1318653905-13716-4-git-send-email-mattjd@gmail.com> (raw)
In-Reply-To: <1318653905-13716-1-git-send-email-mattjd@gmail.com>
x25_find_listener does not check that the amount of call user data given
in the skb is big enough in per-socket comparisons, hence buffer
overreads may occur. Fix this by adding a check.
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Andrew Hendry <andrew.hendry@gmail.com>
Cc: stable <stable@kernel.org>
---
net/x25/af_x25.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index aa567b0..5f03e4e 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -295,7 +295,8 @@ static struct sock *x25_find_listener(struct x25_address *addr,
* Found a listening socket, now check the incoming
* call user data vs this sockets call user data
*/
- if(skb->len > 0 && x25_sk(s)->cudmatchlength > 0) {
+ if (x25_sk(s)->cudmatchlength > 0 &&
+ skb->len >= x25_sk(s)->cudmatchlength) {
if((memcmp(x25_sk(s)->calluserdata.cuddata,
skb->data,
x25_sk(s)->cudmatchlength)) == 0) {
--
1.7.2.5
next prev parent reply other threads:[~2011-10-15 4:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-15 4:45 x25: Fix multiple buffer overruns/overreads Matthew Daley
2011-10-15 4:45 ` [PATCH 1/3] x25: Validate incoming call user data lengths Matthew Daley
2011-10-15 4:45 ` [PATCH 2/3] x25: Handle undersized/fragmented skbs Matthew Daley
2011-10-17 10:28 ` Andrew Hendry
2011-10-15 4:45 ` Matthew Daley [this message]
2011-10-17 10:28 ` [PATCH 3/3] x25: Prevent skb overreads when checking call user data Andrew Hendry
2011-10-17 23:32 ` x25: Fix multiple buffer overruns/overreads David Miller
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=1318653905-13716-4-git-send-email-mattjd@gmail.com \
--to=mattjd@gmail.com \
--cc=andrew.hendry@gmail.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stable@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).