* [PATCH] netfilter: Don't parse CTCP message if shorter than minimum length
@ 2023-06-21 3:29 Sohom
2023-06-21 8:44 ` Florian Westphal
0 siblings, 1 reply; 2+ messages in thread
From: Sohom @ 2023-06-21 3:29 UTC (permalink / raw)
To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Sohom, netfilter-devel, coreteam, netdev, linux-kernel
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 <sohomdatta1+git@gmail.com>
---
net/netfilter/nf_conntrack_irc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nf_conntrack_irc.c b/net/netfilter/nf_conntrack_irc.c
index 5703846bea3b..703b5a123cb5 100644
--- a/net/netfilter/nf_conntrack_irc.c
+++ b/net/netfilter/nf_conntrack_irc.c
@@ -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
--
2.41.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] netfilter: Don't parse CTCP message if shorter than minimum length
2023-06-21 3:29 [PATCH] netfilter: Don't parse CTCP message if shorter than minimum length Sohom
@ 2023-06-21 8:44 ` Florian Westphal
0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2023-06-21 8:44 UTC (permalink / raw)
To: Sohom
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Sohom, netfilter-devel, coreteam, netdev, linux-kernel
Sohom <sohomdatta1@gmail.com> wrote:
> 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.
> + 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.
> /* Skip any whitespace */
> - while (data < data_limit - 10) {
> + while (data < data_limit) {
Why this change?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-21 8:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-21 3:29 [PATCH] netfilter: Don't parse CTCP message if shorter than minimum length Sohom
2023-06-21 8:44 ` Florian Westphal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).