Skip to contentSkip to conversation

cleanup

PATCH In review Thomas Woerner 2 participants 2 messages Sep 9, 2004 – Sep 10, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cleanup

Hello,

I got this patch for iptables in bugzilla #131848 from Steve Grubb. Are including it in the next version?

Thanks in advance,
Thomas

Signature · 5 lines
Thomas Woerner
Software Engineer            Phone: +49-711-96437-310
Red Hat GmbH                 Fax  : +49-711-96437-111
Hauptstaetterstr. 58         Email: Thomas Woerner <[email protected]>
D-70178 Stuttgart            Web  : http://www.redhat.de/
extensions/libipt_REJECT.c +12 -7
diff -ur iptables-1.2.11.orig/extensions/libipt_REJECT.c iptables-1.2.11/extensions/libipt_REJECT.c
@@ -147,13 +147,16 @@
 {
 	const struct ipt_reject_info *reject
 		= (const struct ipt_reject_info *)target->data;
-	unsigned int i;
+	unsigned int i, limit=sizeof(reject_table)/sizeof(struct reject_names);
 
-	for (i = 0; i < sizeof(reject_table)/sizeof(struct reject_names); i++) {
+	for (i = 0; i < limit; i++) {
 		if (reject_table[i].with == reject->with)
 			break;
 	}
-	printf("reject-with %s ", reject_table[i].name);
+	if (i < limit)
+		printf("reject-with %s ", reject_table[i].name);
+	else
+		printf("reject-with: error reject->with not found ");
 }
 
 /* Saves ipt_reject in parsable form to stdout. */
@@ -161,13 +164,15 @@
 {
 	const struct ipt_reject_info *reject
 		= (const struct ipt_reject_info *)target->data;
-	unsigned int i;
+	unsigned int i, limit=sizeof(reject_table)/sizeof(struct reject_names);
 
-	for (i = 0; i < sizeof(reject_table)/sizeof(struct reject_names); i++)
+	for (i = 0; i < limit; i++)
 		if (reject_table[i].with == reject->with)
 			break;
-
-	printf("--reject-with %s ", reject_table[i].name);
+	if (i < limit)
+		printf("--reject-with %s ", reject_table[i].name);
+	else
+		fprintf(stderr, "--reject-with error reject->with not found");
 }
 
 static
extensions/libipt_rpc.c +1 -1
diff -ur iptables-1.2.11.orig/extensions/libipt_rpc.c iptables-1.2.11/extensions/libipt_rpc.c
@@ -252,7 +252,7 @@
 
 			idup = 0;
 			memset(buf, 0, sizeof(buf));
-			dst = (char *)buf - 1;
+			dst = (char *)buf;
 		}
 	}
 
#1 lore raw
Quoted 5 lines · Thomas Woerner

Hello,

I got this patch for iptables in bugzilla #131848 from Steve Grubb. Are including it in the next version?

This doesn't look like cleanup and I'm not going to dig up bugreports from redhat bugzilla. What is this patch supposed to fix ?

Regards
Patrick

Quoted 63 lines

Thanks in advance,
Thomas

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

diff -ur iptables-1.2.11.orig/extensions/libipt_REJECT.c iptables-1.2.11/extensions/libipt_REJECT.c

extensions/libipt_REJECT.c +12 -7
@@ -147,13 +147,16 @@
 {
 	const struct ipt_reject_info *reject
 		= (const struct ipt_reject_info *)target->data;
-	unsigned int i;
+	unsigned int i, limit=sizeof(reject_table)/sizeof(struct reject_names);
 
-	for (i = 0; i < sizeof(reject_table)/sizeof(struct reject_names); i++) {
+	for (i = 0; i < limit; i++) {
 		if (reject_table[i].with == reject->with)
 			break;
 	}
-	printf("reject-with %s ", reject_table[i].name);
+	if (i < limit)
+		printf("reject-with %s ", reject_table[i].name);
+	else
+		printf("reject-with: error reject->with not found ");
 }
 
 /* Saves ipt_reject in parsable form to stdout. */
@@ -161,13 +164,15 @@
 {
 	const struct ipt_reject_info *reject
 		= (const struct ipt_reject_info *)target->data;
-	unsigned int i;
+	unsigned int i, limit=sizeof(reject_table)/sizeof(struct reject_names);
 
-	for (i = 0; i < sizeof(reject_table)/sizeof(struct reject_names); i++)
+	for (i = 0; i < limit; i++)
 		if (reject_table[i].with == reject->with)
 			break;
-
-	printf("--reject-with %s ", reject_table[i].name);
+	if (i < limit)
+		printf("--reject-with %s ", reject_table[i].name);
+	else
+		fprintf(stderr, "--reject-with error reject->with not found");
 }
 
 static

diff -ur iptables-1.2.11.orig/extensions/libipt_rpc.c iptables-1.2.11/extensions/libipt_rpc.c

extensions/libipt_rpc.c +1 -1
@@ -252,7 +252,7 @@
 
 			idup = 0;
 			memset(buf, 0, sizeof(buf));
-			dst = (char *)buf - 1;
+			dst = (char *)buf;
 		}
 	}