netfilter: Don't parse CTCP message if shorter than minimum length
Subsystems (3)
PATCH 1/1 netfilter: Don't parse CTCP message if shorter than minimum length
If the CTCP message is shorter than 10 + 21 + MINMATCHLEN then exit early and don't parse the rest of the message.
Signed-off-by Sohom <[email protected]>
--- net/netfilter/nf_conntrack_irc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/netfilter/nf_conntrack_irc.c +5 -1
@@ -157,8 +157,12 @@ static int help(struct sk_buff *skb, unsigned int protoff, data = ib_ptr; data_limit = ib_ptr + datalen; +if (data >= data_limit - (10 +21 +MINMATCHLEN )) { + goto out; + } +/* Skip any whitespace */ -while (data < data_limit -10 ) { +while (data < data_limit) {if (*data ==' ' || *data =='\r' || *data =='\n' ) data++;else
Signature · 1 line
2.41.0
Florian Westphal
maintainerQuoted 2 lines · Sohom
If the CTCP message is shorter than 10 + 21 + MINMATCHLEN then exit early and don't parse the rest of the message.
Please send a v2 explaining why, not what.
net/netfilter/nf_conntrack_irc.c static int help(struct sk_buff *skb, unsigned int protoff, · line 162
Quoted 3 lines
net/netfilter/nf_conntrack_irc.c +3
-0+if (data >= data_limit - (10 +21 +MINMATCHLEN )) { + goto out; + }
Please run your patches through scripts/checkpatch.pl, we don't use { } for single-line conditional bodies.
net/netfilter/nf_conntrack_irc.c static int help(struct sk_buff *skb, unsigned int protoff, · line 165
Quoted 3 lines
net/netfilter/nf_conntrack_irc.c +1
-1/* Skip any whitespace */ -while (data < data_limit -10 ) { +while (data < data_limit) {
Why this change?