All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] netfilter: nf_ct_h323: restore boundary check correctness
@ 2019-04-25 21:46 Jakub Jankowski
  2019-05-05 22:25 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jankowski @ 2019-04-25 21:46 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Jakub Jankowski

Since commit bc7d811ace4a ("netfilter: nf_ct_h323: Convert
CHECK_BOUND macro to function"), NAT traversal for H.323
doesn't work, failing to parse H323-UserInformation.
nf_h323_error_boundary() compares contents of the bitstring,
not the addresses, preventing valid H.323 packets from being
conntrack'd.

This looks like an oversight from when CHECK_BOUND macro was
converted to a function.

To fix it, stop dereferencing bs->cur and bs->end.

Fixes: bc7d811ace4a ("netfilter: nf_ct_h323: Convert CHECK_BOUND macro to function")
Signed-off-by: Jakub Jankowski <shasta@toxcorp.com>

---
 net/netfilter/nf_conntrack_h323_asn1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_conntrack_h323_asn1.c b/net/netfilter/nf_conntrack_h323_asn1.c
index 1601275efe2d..4c2ef42e189c 100644
--- a/net/netfilter/nf_conntrack_h323_asn1.c
+++ b/net/netfilter/nf_conntrack_h323_asn1.c
@@ -172,7 +172,7 @@ static int nf_h323_error_boundary(struct bitstr *bs, size_t bytes, size_t bits)
 	if (bits % BITS_PER_BYTE > 0)
 		bytes++;
 
-	if (*bs->cur + bytes > *bs->end)
+	if (bs->cur + bytes > bs->end)
 		return 1;
 
 	return 0;
-- 
2.21.0


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

* Re: [PATCH net] netfilter: nf_ct_h323: restore boundary check correctness
  2019-04-25 21:46 [PATCH net] netfilter: nf_ct_h323: restore boundary check correctness Jakub Jankowski
@ 2019-05-05 22:25 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2019-05-05 22:25 UTC (permalink / raw)
  To: Jakub Jankowski; +Cc: netfilter-devel

On Thu, Apr 25, 2019 at 11:46:50PM +0200, Jakub Jankowski wrote:
> Since commit bc7d811ace4a ("netfilter: nf_ct_h323: Convert
> CHECK_BOUND macro to function"), NAT traversal for H.323
> doesn't work, failing to parse H323-UserInformation.
> nf_h323_error_boundary() compares contents of the bitstring,
> not the addresses, preventing valid H.323 packets from being
> conntrack'd.
> 
> This looks like an oversight from when CHECK_BOUND macro was
> converted to a function.
> 
> To fix it, stop dereferencing bs->cur and bs->end.

Applied, thanks.

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

* [PATCH net] netfilter: nf_ct_h323: restore boundary check correctness
@ 2019-04-03  1:25 Jakub Jankowski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Jankowski @ 2019-04-03  1:25 UTC (permalink / raw)
  To: netdev; +Cc: pablo, fw, eric.sesterhenn, Jakub Jankowski

Since commit bc7d811ace4a ("netfilter: nf_ct_h323: Convert
CHECK_BOUND macro to function"), NAT traversal for H.323
doesn't work, failing to parse H323-UserInformation.
nf_h323_error_boundary() compares contents of the bitstring,
not the addresses, preventing valid H.323 packets from being
conntrack'd.

This looks like an oversight from when CHECK_BOUND macro was
converted to a function.

To fix it, stop dereferencing bs->cur and bs->end.

Fixes: bc7d811ace4a ("netfilter: nf_ct_h323: Convert CHECK_BOUND macro to function")
Signed-off-by: Jakub Jankowski <shasta@toxcorp.com>

---
 net/netfilter/nf_conntrack_h323_asn1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_conntrack_h323_asn1.c b/net/netfilter/nf_conntrack_h323_asn1.c
index 1601275efe2d..4c2ef42e189c 100644
--- a/net/netfilter/nf_conntrack_h323_asn1.c
+++ b/net/netfilter/nf_conntrack_h323_asn1.c
@@ -172,7 +172,7 @@ static int nf_h323_error_boundary(struct bitstr *bs, size_t bytes, size_t bits)
 	if (bits % BITS_PER_BYTE > 0)
 		bytes++;
 
-	if (*bs->cur + bytes > *bs->end)
+	if (bs->cur + bytes > bs->end)
 		return 1;
 
 	return 0;
-- 
2.21.0


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

end of thread, other threads:[~2019-05-05 22:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-25 21:46 [PATCH net] netfilter: nf_ct_h323: restore boundary check correctness Jakub Jankowski
2019-05-05 22:25 ` Pablo Neira Ayuso
  -- strict thread matches above, loose matches on Subject: below --
2019-04-03  1:25 Jakub Jankowski

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.