From: Johannes Berg Date: Tue, 6 Nov 2012 10:29:13 +0000 (+0100) Subject: fix bug in iftype_name() X-Git-Tag: v3.8~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a66b3a357bf41a9672c6f3dd96d3a5ad33c9a621;p=thirdparty%2Fiw.git fix bug in iftype_name() If the kernel has been updated, and iw hasn't but was recompiled, the function can return NULL which isn't desirable. Fix it. --- diff --git a/util.c b/util.c index 869e0d6..2983e32 100644 --- a/util.c +++ b/util.c @@ -139,7 +139,7 @@ static char modebuf[100]; const char *iftype_name(enum nl80211_iftype iftype) { - if (iftype <= NL80211_IFTYPE_MAX) + if (iftype <= NL80211_IFTYPE_MAX && ifmodes[iftype]) return ifmodes[iftype]; sprintf(modebuf, "Unknown mode (%d)", iftype); return modebuf;