Bug 172515 - Revert bogus patch
Summary: Revert bogus patch
Alias: None
Product: Fedora
Classification: Fedora
Component: iptables
Version: 4
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Thomas Woerner
QA Contact: Ben Levenson
Depends On:
TreeView+ depends on / blocked
Reported: 2005-11-05 19:23 UTC by Olaf Rempel
Modified: 2007-11-30 22:11 UTC (History)
0 users

Clone Of:
Last Closed: 2005-11-18 12:38:02 UTC

Attachments (Terms of Use)
debug patch. do *not* apply to distribution. (347 bytes, patch)
2005-11-05 19:23 UTC, Olaf Rempel
no flags Details | Diff
Code cleanup patch (567 bytes, patch)
2005-11-09 15:49 UTC, Thomas Woerner
no flags Details | Diff

Description Olaf Rempel 2005-11-05 19:23:47 UTC
Description of problem:
The second part of the patch introduced in #131848 is bogous, more than that, it
introduce a real bug:

diff -ur iptables-1.2.11.orig/extensions/libipt_rpc.c
--- iptables-1.2.11.orig/extensions/libipt_rpc.c        2004-09-05
11:27:50.000000000 -0400
+++ iptables-1.2.11/extensions/libipt_rpc.c     2004-09-05 11:41:11.000000000 -0400
@@ -252,7 +252,7 @@

                        idup = 0;
                        memset(buf, 0, sizeof(buf));
-                       dst = (char *)buf - 1;
+                       dst = (char *)buf;

After dst = buf -1; dst is pointing to invalid memory, but there is a dst++ in
the for()-head before really accessing *dst -> no problem.

*with* this patch, we're accessing buf from [1] not from [0] when filling the
second parameter. But we're always parsing the buf from [0], and thus reading
invalid data.

Version-Release number of selected component (if applicable):
FC4 / iptables-1.3.0-2
(*really* tested with trustix 3.0 / iptables-1.3.3-2tr, while auditing the
iptables patches, which are the same as in FC4 package)

How reproducible:

Steps to Reproduce:
apply attached iptables-debug.patch to see the parsing results without the need
of a ipt_rpc.ko patched kernel. (The "No chain/target/match by that name" errors
came from kernel without a ipt_rpc.ko)

Actual results with bogous patch:
$ iptables -A INPUT -m rpc --rpcs mountd,1000,2000 -j DROP
parsing: 'mountd' -> 100005
parsing: '' -> 0
parsing: '' -> 0
iptables: No chain/target/match by that name

Expected results without bogous patch:
$ iptables -A INPUT -m rpc --rpcs mountd,1000,2000 -j DROP
parsing: 'mountd' -> 100005
parsing: '1000' -> 1000
parsing: '2000' -> 2000
iptables: No chain/target/match by that name

Additional info:

Comment 1 Olaf Rempel 2005-11-05 19:23:47 UTC
Created attachment 120764 [details]
debug patch. do *not* apply to distribution.

Comment 2 Thomas Woerner 2005-11-09 15:49:31 UTC
Created attachment 120845 [details]
Code cleanup patch

I think this patch is a better solution for this problem. It is not good to
point variables beyond the limits of buffers at all.

Comment 3 Olaf Rempel 2005-11-09 17:07:00 UTC
The "invalid" pointer is never used, the next operation will increment it to a
vaild address.

It's maybe not well/beauty written code, but there is no bug/problem at all.
So, why not go with the upstream version?

Comment 4 Thomas Woerner 2005-11-18 12:38:02 UTC
Fixed in rawhide in rpm iptables-1.3.4-1 or newer.

Note You need to log in before you can comment on or make changes to this bug.