All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] off-by-one in DecodeQ931
@ 2016-04-23 17:08 Toby DiPasquale
  2016-04-25 15:29 ` Florian Westphal
  0 siblings, 1 reply; 8+ messages in thread
From: Toby DiPasquale @ 2016-04-23 17:08 UTC (permalink / raw)
  To: pablo, Patrick McHardy, kadlec, davem, netfilter-devel, coreteam,
	netdev

I was reviewing the H.323 conntrack helper in the kernel when I came
across what appears to be an off-by-one error in the DecodeQ931
function. The MessageType field of the Q931 record is assigned and p
is incremented, but the corresponding decrement to sz is missing,
leading the sz variable to be one more than it should be. This patch
decrements sz so it is the proper value going into the parsing of the
information elements.

Signed-off-by: Toby DiPasquale <toby@cbcg.net>
--
diff --git a/net/netfilter/nf_conntrack_h323_asn1.c
b/net/netfilter/nf_conntrack_h323_asn1.c
index bcd5ed6..68b1557 100644
--- a/net/netfilter/nf_conntrack_h323_asn1.c
+++ b/net/netfilter/nf_conntrack_h323_asn1.c
@@ -849,6 +849,7 @@ int DecodeQ931(unsigned char *buf, size_t sz, Q931 *q931)
        if (sz < 1)
                return H323_ERROR_BOUND;
        q931->MessageType = *p++;
+       sz--;
        PRINT("MessageType = %02X\n", q931->MessageType);
        if (*p & 0x80) {
                p++;


-- 
Toby DiPasquale

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

end of thread, other threads:[~2016-06-12 23:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-23 17:08 [PATCH] off-by-one in DecodeQ931 Toby DiPasquale
2016-04-25 15:29 ` Florian Westphal
2016-05-03  5:12   ` Toby DiPasquale
2016-05-21  0:20     ` Toby DiPasquale
2016-06-06 13:50     ` Toby DiPasquale
2016-06-06 14:35       ` Florian Westphal
2016-06-06 14:55         ` Pablo Neira Ayuso
2016-06-12 23:29           ` Toby DiPasquale

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.