Skip to contentSkip to conversation

osf: fixed matching bug.

PATCH Applied Evgeniy Polyakov 2 participants 2 messages Aug 21, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 osf: fixed matching bug.

Fixed matching bug - when we have match and have options to process not only first one but all, then we may rewrite fmatch value with FMATCH_WRONG parameters. Later osf will create decision based on the latest fmatch value, but not the fact that osf had match before.

Evgeniy Polyakov ( s0mbre )

Only failure makes us experts. -- Theo de Raadt

patch-o-matic-ng/osf/linux-2.6/net/ipv4/netfilter/ipt_osf.c +4 -1
@@ -411,8 +413,11 @@
 		}
 	}
 
-	read_unlock(&osf_lock);
+	if (fcount)
+		fmatch = FMATCH_OK;
 
+	read_unlock(&osf_lock);
+	
 	return (fmatch == FMATCH_OK)?1:0;
 }
 
#1 lore raw
Quoted 5 lines · Evgeniy Polyakov

Fixed matching bug - when we have match and have options to process not only first one but all, then we may rewrite fmatch value with FMATCH_WRONG parameters. Later osf will create decision based on the latest fmatch value, but not the fact that osf had match before.

Quoted 7 lines

Evgeniy Polyakov ( s0mbre )

Only failure makes us experts. -- Theo de Raadt

Applied to 2.4 and 2.6, but hand edited, you don't need to move the lock for a local variable.

linux-2.6/net/ipv4/netfilter/ipt_osf.c 21 Aug 2004 22:10:02 -0000 renamed from linux-2.6/net/ipv4/netfilter/ipt_osf.c 22 Jul 2004 19:21:58 -0000 1.1 +3 -0
diff -u -r1.1 ipt_osf.c
@@ -412,6 +412,9 @@
       }
 
       read_unlock(&osf_lock);
+
+       if (fcount)
+               fmatch = FMATCH_OK;
 
       return (fmatch == FMATCH_OK)?1:0;

}

Quoted 19 lines

------------------------------------------------------------------------

patch-o-matic-ng/osf/linux-2.6/net/ipv4/netfilter/ipt_osf.c +4 -1
@@ -411,8 +413,11 @@
 		}
 	}
 
-	read_unlock(&osf_lock);
+	if (fcount)
+		fmatch = FMATCH_OK;
 
+	read_unlock(&osf_lock);
+	
 	return (fmatch == FMATCH_OK)?1:0;
 }