From f399616db8ceb42d2998a9c413a4c3c012cbe135 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 5 Mar 2012 17:52:46 +0000 Subject: iwinfo: fix integer overflow in assoclist rate reporting (#11073) SVN-Revision: 30825 --- package/iwinfo/src/include/iwinfo.h | 2 +- package/iwinfo/src/iwinfo_cli.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'package/iwinfo/src') diff --git a/package/iwinfo/src/include/iwinfo.h b/package/iwinfo/src/include/iwinfo.h index 9e78bab70e..868c10b359 100644 --- a/package/iwinfo/src/include/iwinfo.h +++ b/package/iwinfo/src/include/iwinfo.h @@ -61,7 +61,7 @@ extern const char *IWINFO_OPMODE_NAMES[]; struct iwinfo_rate_entry { - uint16_t rate; + uint32_t rate; int8_t mcs; uint8_t is_40mhz:1; uint8_t is_short_gi:1; diff --git a/package/iwinfo/src/iwinfo_cli.c b/package/iwinfo/src/iwinfo_cli.c index 0fdb21ec67..7ec5aef95c 100644 --- a/package/iwinfo/src/iwinfo_cli.c +++ b/package/iwinfo/src/iwinfo_cli.c @@ -134,7 +134,8 @@ static char * format_rate(int rate) if (rate <= 0) snprintf(buf, sizeof(buf), "unknown"); else - snprintf(buf, sizeof(buf), "%.1f MBit/s", ((float)rate / 1000.0)); + snprintf(buf, sizeof(buf), "%d.%d MBit/s", + rate / 1000, (rate % 1000) / 100); return buf; } -- cgit v1.2.3