netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net/x25: fix address parsing bug in x25_parse_address_block.
@ 2013-06-19 20:32 Stephen Moorby
  2013-06-20  0:59 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Moorby @ 2013-06-19 20:32 UTC (permalink / raw)
  To: davem, sasha.levin, akpm, paulmck, jiri, linux-x25, netdev,
	linux-kernel
  Cc: Stephen Moorby

This problem was discovered when a linux box was incorrectly rejecting
calls from some X.25 equipment.  The problem was diagnosed to an incorrect
address length calculation in 'x25_parse_address_block', the calculation
did not account for the address digits being BCD encoded.  The correct
calculation is already performed on line 155.

Patched on linux-next 18-Jun-2013
Tested on 2.6.32-45-generic

Signed-off-by: Stephen Moorby <steve.moorby@ntlworld.com>
---
 net/x25/af_x25.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 1d964e2..eb6c1f9 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -98,7 +98,8 @@ int x25_parse_address_block(struct sk_buff *skb,
 	}
 
 	len = *skb->data;
-	needed = 1 + (len >> 4) + (len & 0x0f);
+	/* need 1 for address length + bytes for BCD encoding of 2 addresses */
+	needed = 1 + (((len >> 4) + (len & 0x0f) + 1) >> 1);
 
 	if (!pskb_may_pull(skb, needed)) {
 		/* packet is too short to hold the addresses it claims
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH 1/1] net/x25: fix address parsing bug in x25_parse_address_block.
@ 2013-06-19 11:13 Stephen Moorby
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Moorby @ 2013-06-19 11:13 UTC (permalink / raw)
  To: andrew.hendry, davem, sasha.levin, akpm, paulmck, jiri, linux-x25,
	netdev, linux-kernel

 From 01ba835311f6d2e2bbffc74703d704dc07803b53 Mon Sep 17 00:00:00 2001
From: Stephen Moorby <steve.moorby@ntlworld.com>
Date: Wed, 19 Jun 2013 11:48:53 +0100
Subject: [PATCH 1/1] net/x25: fix address parsing bug in
  x25_parse_address_block.

This problem was discovered when a linux box was incorrectly rejecting
calls from some X.25 equipment.  The problem was diagnosed to an incorrect
address length calculation in 'x25_parse_address_block', the calculation
did not account for the address digits being BCD encoded.  The correct
calculation is already performed on line 155.

Patched on linux-next 18-Jun-2013
Tested on 2.6.32-45-generic

Signed-off-by: Stephen Moorby <steve.moorby@ntlworld.com>
---
  net/x25/af_x25.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 1d964e2..eb6c1f9 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -98,7 +98,8 @@ int x25_parse_address_block(struct sk_buff *skb,
      }

      len = *skb->data;
-    needed = 1 + (len >> 4) + (len & 0x0f);
+    /* need 1 for address length + bytes for BCD encoding of 2 addresses */
+    needed = 1 + (((len >> 4) + (len & 0x0f) + 1) >> 1);

      if (!pskb_may_pull(skb, needed)) {
          /* packet is too short to hold the addresses it claims
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-20  0:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-19 20:32 [PATCH 1/1] net/x25: fix address parsing bug in x25_parse_address_block Stephen Moorby
2013-06-20  0:59 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2013-06-19 11:13 Stephen Moorby

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).