aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemming@brocade.com>2015-12-10 08:52:10 -0800
committerStephen Hemminger <shemming@brocade.com>2015-12-10 08:52:10 -0800
commit654ae881de57467642c8c2ed16ffc3a8d57fafa2 (patch)
treedaf70a37b92f2bdd58613344aae8214b9a5b3ef3
parentb08b5ff128874f94a1bc9dd8e178fa0e57c11c61 (diff)
downloadandroid_external_iproute2-654ae881de57467642c8c2ed16ffc3a8d57fafa2.tar.gz
android_external_iproute2-654ae881de57467642c8c2ed16ffc3a8d57fafa2.tar.bz2
android_external_iproute2-654ae881de57467642c8c2ed16ffc3a8d57fafa2.zip
ip: fix format string when reading statistics
The tunnel code was doing sscanf(buf, "%ld", &x) where x was unsigned long.
-rw-r--r--ip/ip6tunnel.c2
-rw-r--r--ip/iptunnel.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c
index 320d253..1737d88 100644
--- a/ip/ip6tunnel.c
+++ b/ip/ip6tunnel.c
@@ -354,7 +354,7 @@ static int do_tunnels_list(struct ip6_tnl_parm2 *p)
fprintf(stderr, "Wrong format for /proc/net/dev. Giving up.\n");
goto end;
}
- if (sscanf(ptr, "%ld%ld%ld%ld%ld%ld%ld%*d%ld%ld%ld%ld%ld%ld%ld",
+ if (sscanf(ptr, "%lu%lu%lu%lu%lu%lu%lu%*d%lu%lu%lu%lu%lu%lu%lu",
&rx_bytes, &rx_packets, &rx_errs, &rx_drops,
&rx_fifo, &rx_frame, &rx_multi,
&tx_bytes, &tx_packets, &tx_errs, &tx_drops,
diff --git a/ip/iptunnel.c b/ip/iptunnel.c
index ce9ee32..a3ff99b 100644
--- a/ip/iptunnel.c
+++ b/ip/iptunnel.c
@@ -419,7 +419,7 @@ static int do_tunnels_list(struct ip_tunnel_parm *p)
fprintf(stderr, "Wrong format for /proc/net/dev. Giving up.\n");
goto end;
}
- if (sscanf(ptr, "%ld%ld%ld%ld%ld%ld%ld%*d%ld%ld%ld%ld%ld%ld%ld",
+ if (sscanf(ptr, "%lu%lu%lu%lu%lu%lu%lu%*d%lu%lu%lu%lu%lu%lu%lu",
&rx_bytes, &rx_packets, &rx_errs, &rx_drops,
&rx_fifo, &rx_frame, &rx_multi,
&tx_bytes, &tx_packets, &tx_errs, &tx_drops,