iwinfo: fix integer overflow in assoclist rate reporting (#11073)

SVN-Revision: 30825
master
Jo-Philipp Wich 13 years ago
parent 1029786936
commit f399616db8
  1. 2
      package/iwinfo/Makefile
  2. 2
      package/iwinfo/src/include/iwinfo.h
  3. 3
      package/iwinfo/src/iwinfo_cli.c

@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=libiwinfo PKG_NAME:=libiwinfo
PKG_RELEASE:=31 PKG_RELEASE:=32
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_CONFIG_DEPENDS := \ PKG_CONFIG_DEPENDS := \

@ -61,7 +61,7 @@ extern const char *IWINFO_OPMODE_NAMES[];
struct iwinfo_rate_entry { struct iwinfo_rate_entry {
uint16_t rate; uint32_t rate;
int8_t mcs; int8_t mcs;
uint8_t is_40mhz:1; uint8_t is_40mhz:1;
uint8_t is_short_gi:1; uint8_t is_short_gi:1;

@ -134,7 +134,8 @@ static char * format_rate(int rate)
if (rate <= 0) if (rate <= 0)
snprintf(buf, sizeof(buf), "unknown"); snprintf(buf, sizeof(buf), "unknown");
else 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; return buf;
} }

Loading…
Cancel
Save