Skip to contentSkip to conversation

ip_conntrack_ftp segfault

PATCH Applied Nicolas Bouliane 3 participants 4 messages Jan 3, 2005 – Feb 1, 2005

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

PATCH 1/1 ip_conntrack_ftp segfault

Hi,

This patch fix two bugs (when DEBUGP is defined):
o The var data doesn't exist, hence gcc complains.
o It segfault because we print an integer with %s.

Cheers! :)

-acidfu

ip_conntrack_ftp.c renamed from usr/src/old/linux-2.6.10/net/ipv4/netfilter/ip_conntrack_ftp.c +2 -3
@@ -347,9 +347,8 @@
 		goto out;
 	}
 
-	DEBUGP("conntrack_ftp: match `%.*s' (%u bytes at %u)\n",
-	       (int)matchlen, data + matchoff,
-	       matchlen, ntohl(th->seq) + matchoff);
+	DEBUGP("conntrack_ftp: match `%s' (%u bytes at %u)\n",
+			search[i].pattern, matchlen, ntohl(th->seq) + matchoff);
 
 	/* Allocate expectation which will be inserted */
 	exp = ip_conntrack_expect_alloc();
#1 lore raw

nice catch, but read the comments below.

ip_conntrack_ftp.c

Quoted 10 lines · Nicolas Bouliane

This patch fix two bugs (when DEBUGP is defined):
o The var data doesn't exist, hence gcc complains.
o It segfault because we print an integer with %s.

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

ip_conntrack_ftp.c renamed from usr/src/old/linux-2.6.10/net/ipv4/netfilter/ip_conntrack_ftp.c +0 -0

this header must always look like, for example:

--- linux-2.6.10/net/ipv4/netfilter/ip_conntrack_ftp.c 2004-10-20 10:12:06 +02:00
+++ linux-2.6.10-nicolas/net/ipv4/netfilter/ip_conntrack_ftp.c 2005-01-02 16:09:01 +01:00

ip_conntrack_ftp.c line 353

Quoted 11 lines
ip_conntrack_ftp.c renamed from usr/src/old/linux-2.6.10/net/ipv4/netfilter/ip_conntrack_ftp.c +2 -3
@@ -347,9 +347,8 @@
 		goto out;
 	}
 
-	DEBUGP("conntrack_ftp: match `%.*s' (%u bytes at %u)\n",
-	       (int)matchlen, data + matchoff,
-	       matchlen, ntohl(th->seq) + matchoff);
+	DEBUGP("conntrack_ftp: match `%s' (%u bytes at %u)\n",
+			search[i].pattern, matchlen, ntohl(th->seq) + matchoff);
 
 

Since this is a minor fix, try to modify as less things as you can. data doesn't exist but look for its natural replacement which is fb_ptr.

Rusty punish me yesterday to read part (11) of Documentation/SubmittingPatches in the kernel source tree :). So do it you as well and add your sign-off.

Resend a patch which fixes the things above. After that, let wait to see if Patrick wants to add this to his changeset 8).

--
Pablo

#2 lore raw
Quoted 3 lines · Pablo Neira

nice catch, but read the comments below.

Since this is a minor fix, try to modify as less things as you can. data doesn't exist but look for its natural replacement which is fb_ptr.

Hey Pablo, thanks for the hints! :)

Quoted 3 lines
Quoted 3 lines

This patch fix two bugs (when DEBUGP is defined):
o The var data doesn't exist, hence gcc complains.
o It segfault because we print an integer with %s.

net/ipv4/netfilter/ip_conntrack_ftp.c +3 -4
@@ -347,10 +347,9 @@
 		goto out;
 	}
 
-	DEBUGP("conntrack_ftp: match `%.*s' (%u bytes at %u)\n",
-	       (int)matchlen, data + matchoff,
-	       matchlen, ntohl(th->seq) + matchoff);
-
+	DEBUGP("conntrack_ftp: match `%s' (%u bytes at %u)\n",
+	       fb_ptr + matchoff, matchlen, ntohl(th->seq) + matchoff);
+			 
 	/* Allocate expectation which will be inserted */
 	exp = ip_conntrack_expect_alloc();
 	if (exp == NULL) {
#3 lore raw
Quoted 6 lines · Nicolas Bouliane
Quoted 4 lines
Quoted 3 lines

This patch fix two bugs (when DEBUGP is defined):
o The var data doesn't exist, hence gcc complains.
o It segfault because we print an integer with %s.

Applied, thanks.

Regards
Patrick