]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: Fix bitrate output when no rate info found
authorMasashi Honma <masashi.honma@gmail.com>
Tue, 14 Feb 2017 09:38:58 +0000 (18:38 +0900)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 14 Feb 2017 09:44:13 +0000 (10:44 +0100)
Previously, bitrate showed uninitialized buffer when no rate info found.
This patch fixes the issue.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
station.c

index f3e3da83398cab298baa156e2ebdbab032cd107f..4885dc07d7c6eda064c16820630bae8173fc6ac3 100644 (file)
--- a/station.c
+++ b/station.c
@@ -151,6 +151,8 @@ void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen)
        if (rate > 0)
                pos += snprintf(pos, buflen - (pos - buf),
                                "%d.%d MBit/s", rate / 10, rate % 10);
+       else
+               pos += snprintf(pos, buflen - (pos - buf), "(unknown)");
 
        if (rinfo[NL80211_RATE_INFO_MCS])
                pos += snprintf(pos, buflen - (pos - buf),