Re: [PATCH] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq

From: Liping Zhang
Date: Mon Jul 04 2016 - 07:43:51 EST


2016-07-04 14:14 GMT+08:00 Christophe Leroy <christophe.leroy@xxxxxx>:
>> I think there is no need to convert simple_strtoul to kstrtouint, add
>> a further check seems better?
>> Like this:
>> - if (!cseq) {
>> + if (!cseq && *(*dptr + matchoff) != '0') {
>>
>
> And what about an invalid CSeq that would look like CSeq: 0abzk852 ?
> Should we check it is 0 + space instead ?

In this case, i.e. some stupid sip clients set CSeq to "0abzk852",
your patch will also fail to detect this "error".

Because for "Cseq", int (*match_len)(...) point to digits_len(see
struct sip_header ct_sip_hdrs definition).
So in this case match_len will just be setted to ONE (not
sizeof("0abzk852")-1), then cseq will be parsed
as 0 by kstrtouint, not as an error.