Skip to contentSkip to conversation

nf_conntrack_sip: check for trailing spaces

PATCH In review Ulrich Weber 2 participants 2 messages Oct 18, 2016

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

PATCH 1/1 nf_conntrack_sip: check for trailing spaces

on SIP requests, so a fragmented TCP SIP packet starting with
INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE,SUBSCRIBE
Content-Length: 0

will not bet interpreted as an INVITE request.

Confirm with RFC 3261
Request-Line = Method SP Request-URI SP SIP-Version CRLF

---
 net/netfilter/nf_conntrack_sip.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/netfilter/nf_conntrack_sip.c +3 -1
index 7700556..e37f8da 100644
@@ -1436,9 +1436,11 @@ static int process_sip_request(struct sk_buff *skb, unsigned int protoff,
 		handler = &sip_handlers[i];
 		if (handler->request == NULL)
 			continue;
-		if (*datalen < handler->len ||
+		if (*datalen < handler->len + 1 ||
 		    strncasecmp(*dptr, handler->method, handler->len))
 			continue;
+		if ((*dptr)[handler->len] != ' ')
+			continue;
 
 		if (ct_sip_get_header(ct, *dptr, 0, *datalen, SIP_HDR_CSEQ,
 				      &matchoff, &matchlen) <= 0) {
Signature · 1 line
2.7.4
#1 lore raw

Hi Ulrich,

Quoted 8 lines · Ulrich Weber

on SIP requests, so a fragmented TCP SIP packet starting with
INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE,SUBSCRIBE
Content-Length: 0

will not bet interpreted as an INVITE request.

Confirm with RFC 3261
Request-Line = Method SP Request-URI SP SIP-Version CRLF

Please, submit this to [email protected].

Thanks.