1
0
forked from jengelh/iptables
iptables/iptables-1.3.8-strict-aliasing-fix.diff

82 lines
2.6 KiB
Diff

--- 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 */
--- ip6tables.c
+++ ip6tables.c
@@ -1874,5 +1874,6 @@
char *protocol = NULL;
int proto_used = 0;
+ u_int64_t *p_cnt;
memset(&fw, 0, sizeof(fw));
@@ -2185,13 +2186,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));
--- 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 */
--- iptables.c
+++ iptables.c
@@ -1956,6 +1956,7 @@
char *protocol = 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
@@ -2279,12 +2279,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));