All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Rosenberg <drosenberg@vsecurity.com>
To: andrew.hendry@gmail.com
Cc: netdev@vger.kernel.org, security@kernel.org, stable@kernel.org
Subject: [SECURITY] memory corruption in X.25 facilities parsing
Date: Tue, 02 Nov 2010 11:02:48 -0400	[thread overview]
Message-ID: <1288710168.2504.6.camel@dan> (raw)

I put this together after a quick glance, so if someone knows this code
better than I do (i.e. at all), feel free to comment or drop this patch
if it's unnecessary.

A value of 0 will cause a memcpy() of ULONG_MAX size, destroying the
kernel heap.

Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>

--- linux-2.6.36-rc6.orig/net/x25/x25_facilities.c	2010-09-28 21:01:22.000000000 -0400
+++ linux-2.6.36-rc6/net/x25/x25_facilities.c	2010-11-02 10:36:02.827291324 -0400
@@ -134,14 +134,14 @@ int x25_parse_facilities(struct sk_buff 
 		case X25_FAC_CLASS_D:
 			switch (*p) {
 			case X25_FAC_CALLING_AE:
-				if (p[1] > X25_MAX_DTE_FACIL_LEN)
+				if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] == 0)
 					break;
 				dte_facs->calling_len = p[2];
 				memcpy(dte_facs->calling_ae, &p[3], p[1] - 1);
 				*vc_fac_mask |= X25_MASK_CALLING_AE;
 				break;
 			case X25_FAC_CALLED_AE:
-				if (p[1] > X25_MAX_DTE_FACIL_LEN)
+				if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] == 0)
 					break;
 				dte_facs->called_len = p[2];
 				memcpy(dte_facs->called_ae, &p[3], p[1] - 1);



             reply	other threads:[~2010-11-02 15:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-02 15:02 Dan Rosenberg [this message]
2010-11-03  1:12 ` [SECURITY] memory corruption in X.25 facilities parsing Andrew Hendry
2010-11-03 22:54   ` Andrew Hendry
2010-11-03 23:44     ` Dan Rosenberg
2010-11-04  1:56       ` 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=1288710168.2504.6.camel@dan \
    --to=drosenberg@vsecurity.com \
    --cc=andrew.hendry@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=security@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.