Skip to contentSkip to conversation

fix off-by-one in DecodeQ931

PATCH Applied Toby DiPasquale 2 participants 2 messages Jul 9, 2016 – Jul 11, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix off-by-one in DecodeQ931

fix off-by-one in DecodeQ931

This patch corrects an off-by-one error in the DecodeQ931 function in the nf_conntrack_h323 module. This error could result in reading off the end of a Q.931 frame.

---
 net/netfilter/nf_conntrack_h323_asn1.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_conntrack_h323_asn1.c +2 -1
index bcd5ed6..89b2e46 100644
@@ -846,9 +846,10 @@ int DecodeQ931(unsigned char *buf, size_t sz, Q931 *q931)
 	sz -= len;
 
 	/* Message Type */
-	if (sz < 1)
+	if (sz < 2)
 		return H323_ERROR_BOUND;
 	q931->MessageType = *p++;
+	sz--;
 	PRINT("MessageType = %02X\n", q931->MessageType);
 	if (*p & 0x80) {
 		p++;
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 5 lines · Toby DiPasquale

fix off-by-one in DecodeQ931

This patch corrects an off-by-one error in the DecodeQ931 function in the nf_conntrack_h323 module. This error could result in reading off the end of a Q.931 frame.

Applied to nf-next, thanks.

I have fixed the timestamp since your clock doesn't look right as this was placed way ahead in the future.