From: Michal Soltys <soltys@ziu.info>
To: jengelh@medozas.de
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH] xt_u32.c - make negative offsets work near / at the end of packet
Date: Sun, 6 Sep 2009 02:36:38 +0200 [thread overview]
Message-ID: <1252197398-23863-2-git-send-email-soltys@ziu.info> (raw)
In-Reply-To: <1252197398-23863-1-git-send-email-soltys@ziu.info>
Current sanity checks in xt_u32.c inhibit successful use of negative
offets when the current position is near or at the end of a packet.
The following patch changes the sanity checks to be a bit more
flexible - values read from the packet and specified as @ offsets
can be interpreted both as positive and negative.
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
net/netfilter/xt_u32.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/net/netfilter/xt_u32.c b/net/netfilter/xt_u32.c
index 24a5276..bb3a63d 100644
--- a/net/netfilter/xt_u32.c
+++ b/net/netfilter/xt_u32.c
@@ -58,15 +58,11 @@ static bool u32_match_it(const struct xt_u32 *data,
val >>= number;
break;
case XT_U32_AT:
- if (at + val < at)
- return false;
at += val;
- pos = number;
- if (at + 4 < at || skb->len < at + 4 ||
- pos > skb->len - at - 4)
+ if (at + number + 4 < 4 || skb->len < at + number + 4)
return false;
- if (skb_copy_bits(skb, at + pos, &n,
+ if (skb_copy_bits(skb, at + number, &n,
sizeof(n)) < 0)
BUG();
val = ntohl(n);
--
1.6.4
next prev parent reply other threads:[~2009-09-06 0:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-06 0:36 [PATCH] xt_u32.c - make negative offsets work near / at the end of packet Michal Soltys
2009-09-06 0:36 ` Michal Soltys [this message]
2009-09-06 1:01 ` Jan Engelhardt
2009-09-06 9:31 ` Michal Soltys
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=1252197398-23863-2-git-send-email-soltys@ziu.info \
--to=soltys@ziu.info \
--cc=jengelh@medozas.de \
--cc=netfilter-devel@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).