Skip to contentSkip to conversation

skb_find_text ignores to argument

PATCH In review Phil Oester 2 participants 2 messages Jun 25, 2006 – Jun 26, 2006

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

PATCH 1/1 skb_find_text ignores to argument

skb_find_text takes a "to" argument which is supposed to limit how far into the skb it will search for the given text. At present, it seems to ignore that argument on the first skb, and instead return a match even if the text occurs beyond the limit.

Patch below fixes this, after adjusting for the "from" starting point. This consequently fixes the netfilter string match's "--to" handling, which currently is broken.

Phil

net/core/skbuff.c +4 -1
diff -ruN linux-orig/net/core/skbuff.c linux-new/net/core/skbuff.c
@@ -1739,12 +1739,15 @@
 			   unsigned int to, struct ts_config *config,
 			   struct ts_state *state)
 {
+	unsigned int ret;
+
 	config->get_next_block = skb_ts_get_next_block;
 	config->finish = skb_ts_finish;
 
 	skb_prepare_seq_read(skb, from, to, TS_SKB_CB(state));
 
-	return textsearch_find(config, state);
+	ret = textsearch_find(config, state);
+	return (ret <= to - from ? ret : UINT_MAX);
 }
 
 /**
maintainer
#1 lore raw

From: Phil Oester <[email protected]>
Date: Sun, 25 Jun 2006 07:52:00 -0700

Quoted 10 lines

skb_find_text takes a "to" argument which is supposed to limit how far into the skb it will search for the given text. At present, it seems to ignore that argument on the first skb, and instead return a match even if the text occurs beyond the limit.

Patch below fixes this, after adjusting for the "from" starting point. This consequently fixes the netfilter string match's "--to" handling, which currently is broken.

Looks good, applied.

Thanks Phil.