All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Add checking of out-of-range on Choices' index values
@ 2007-07-04 16:49 Jing Min Zhao
  2007-07-05 18:29 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Jing Min Zhao @ 2007-07-04 16:49 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: Netfilter Development Mailinglist

Choices' index values may be out of range while still encoded in the fixed length bit-field. This bug may cause access to undefined types (NULL pointers) and thus crashes (Reported by Zhongling Wen).

This patch also adds checking of decode flag when decoding SEQUENCEs.

Signed-off-by: Jing Min Zhao <zhaojingmin@vivecode.com>
---
 net/netfilter/nf_conntrack_h323_asn1.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/netfilter/nf_conntrack_h323_asn1.c b/net/netfilter/nf_conntrack_h323_asn1.c
index f6fad71..6b7eaa0 100644
--- a/net/netfilter/nf_conntrack_h323_asn1.c
+++ b/net/netfilter/nf_conntrack_h323_asn1.c
@@ -518,7 +518,7 @@ int decode_seq(bitstr_t * bs, field_t * f, char *base, int level)
 			CHECK_BOUND(bs, 2);
 			len = get_len(bs);
 			CHECK_BOUND(bs, len);
-			if (!base) {
+			if (!base || !(son->attr & DECODE)) {
 				PRINT("%*.s%s\n", (level + 1) * TAB_SIZE,
 				      " ", son->name);
 				bs->cur += len;
@@ -704,6 +704,8 @@ int decode_choice(bitstr_t * bs, field_t * f, char *base, int level)
 	} else {
 		ext = 0;
 		type = get_bits(bs, f->sz);
+		if (type >= f->lb)
+			return H323_ERROR_RANGE;
 	}
 
 	/* Write Type */
-- 
1.4.4.3

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

* Re: [PATCH 1/1] Add checking of out-of-range on Choices' index values
  2007-07-04 16:49 [PATCH 1/1] Add checking of out-of-range on Choices' index values Jing Min Zhao
@ 2007-07-05 18:29 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2007-07-05 18:29 UTC (permalink / raw)
  To: Jing Min Zhao; +Cc: Netfilter Development Mailinglist

Jing Min Zhao wrote:
> Choices' index values may be out of range while still encoded in the fixed length bit-field. This bug may cause access to undefined types (NULL pointers) and thus crashes (Reported by Zhongling Wen).
> 
> This patch also adds checking of decode flag when decoding SEQUENCEs.


Thanks for fixing this so quickly, applied. I'll also push the
patch to -stable.

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

end of thread, other threads:[~2007-07-05 18:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-04 16:49 [PATCH 1/1] Add checking of out-of-range on Choices' index values Jing Min Zhao
2007-07-05 18:29 ` Patrick McHardy

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.