diff mbox series

[net] netfilter: nf_ct_h323: restore boundary check correctness

Message ID 20190425214650.518-1-shasta@toxcorp.com
State Accepted
Delegated to: Pablo Neira
Headers show
Series [net] netfilter: nf_ct_h323: restore boundary check correctness | expand

Commit Message

Jakub Jankowski April 25, 2019, 9:46 p.m. UTC
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(-)

Comments

Pablo Neira Ayuso May 5, 2019, 10:25 p.m. UTC | #1
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.
diff mbox series

Patch

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;