netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Ostadal <postadal@suse.cz>
To: netfilter-devel@lists.netfilter.org
Subject: Patch fixes strict aliasing
Date: Thu, 14 Sep 2006 15:58:51 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0609141546430.731@basilisk.suse.cz> (raw)

[-- Attachment #1: Type: TEXT/PLAIN, Size: 408 bytes --]

Hi,

I attached patch which fixes strict aliasing. (https://bugzilla.netfilter.org/bugzilla/show_bug.cgi?id=510)

	Petr
--
Best Regards,

Petr Ostadal
Software Developer
---------------------------------------------------------------------
SUSE LINUX, s.r.o. 			e-mail: postadal@suse.cz
Lihovarska 1060/12			tel:	+420 284 028 967
190 00 Praha 9 				fax:	+420 284 028 951
Czech Republic 				http://www.suse.cz

[-- Attachment #2: Type: TEXT/x-patch, Size: 2783 bytes --]

--- ip6tables.c
+++ ip6tables.c
@@ -1724,6 +1724,7 @@
 	const char *modprobe = NULL;
 	int proto_used = 0;
 	char icmp6p[] = "icmpv6";
+	u_int64_t *p_cnt;
 
 	memset(&fw, 0, sizeof(fw));
 
@@ -2030,13 +2031,15 @@
 				exit_error(PARAMETER_PROBLEM,
 					"-%c requires packet and byte counter",
 					opt2char(OPT_COUNTERS));

-			if (sscanf(pcnt, "%llu", (unsigned long long *)&fw.counters.pcnt) != 1)
+			p_cnt = &fw.counters.pcnt;
+			if (sscanf(pcnt, "%llu", (unsigned long long *)p_cnt) != 1)
 				exit_error(PARAMETER_PROBLEM,
 					"-%c packet counter not numeric",
 					opt2char(OPT_COUNTERS));
 
-			if (sscanf(bcnt, "%llu", (unsigned long long *)&fw.counters.bcnt) != 1)
+			p_cnt = &fw.counters.bcnt;
+			if (sscanf(bcnt, "%llu", (unsigned long long *)p_cnt) != 1)
 				exit_error(PARAMETER_PROBLEM,
 					"-%c byte counter not numeric",
 					opt2char(OPT_COUNTERS));
--- ip6tables-restore.c
+++ ip6tables-restore.c
@@ -76,7 +76,9 @@
 
 int parse_counters(char *string, struct ip6t_counters *ctr)
 {
-	return (sscanf(string, "[%llu:%llu]", (unsigned long long *)&ctr->pcnt, (unsigned long long *)&ctr->bcnt) == 2);
+	u_int64_t *p_pcnt = &ctr->pcnt;
+	u_int64_t *p_bcnt = &ctr->bcnt;
+	return (sscanf(string, "[%llu:%llu]", (unsigned long long *)p_pcnt, (unsigned long long *)p_bcnt) == 2);
 }
 
 /* global new argv and argc */
--- iptables.c
+++ iptables.c
@@ -1846,7 +1846,8 @@
 	char *protocol = NULL;
 	const char *modprobe = NULL;
 	int proto_used = 0;
-
+    u_int64_t *p_cnt;
+    
 	memset(&fw, 0, sizeof(fw));
 
 	/* re-set optind to 0 in case do_command gets called
@@ -2159,12 +2160,14 @@
 					"-%c requires packet and byte counter",
 					opt2char(OPT_COUNTERS));
 
-			if (sscanf(pcnt, "%llu", (unsigned long long *)&fw.counters.pcnt) != 1)
+			p_cnt = &fw.counters.pcnt;
+			if (sscanf(pcnt, "%llu", (unsigned long long *)p_cnt) != 1)
 				exit_error(PARAMETER_PROBLEM,
 					"-%c packet counter not numeric",
 					opt2char(OPT_COUNTERS));
 
-			if (sscanf(bcnt, "%llu", (unsigned long long *)&fw.counters.bcnt) != 1)
+			p_cnt = &fw.counters.bcnt;
+			if (sscanf(bcnt, "%llu", (unsigned long long *)p_cnt) != 1)
 				exit_error(PARAMETER_PROBLEM,
 					"-%c byte counter not numeric",
 					opt2char(OPT_COUNTERS));
--- iptables-restore.c
+++ iptables-restore.c
@@ -73,7 +73,9 @@
 
 int parse_counters(char *string, struct ipt_counters *ctr)
 {
-	return (sscanf(string, "[%llu:%llu]", (unsigned long long *)&ctr->pcnt, (unsigned long long *)&ctr->bcnt) == 2);
+	u_int64_t *p_pcnt = &ctr->pcnt;
+	u_int64_t *p_bcnt = &ctr->bcnt;
+	return (sscanf(string, "[%llu:%llu]", (unsigned long long *)p_pcnt, (unsigned long long *)p_bcnt) == 2);
 }
 
 /* global new argv and argc */

             reply	other threads:[~2006-09-14 13:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-14 13:58 Petr Ostadal [this message]
2007-02-13 11:24 ` Patch fixes strict aliasing Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0609141546430.731@basilisk.suse.cz \
    --to=postadal@suse.cz \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).