struct regdb_file_header *header;
struct regdb_file_reg_country *countries;
int dblen, siglen, num_countries, i, j, r;
- char alpha2[2];
+ char alpha2[3] = {}; /* NUL-terminate */
char *env_country;
struct nl80211_state nlstate;
struct nl_cb *cb = NULL;
sizeof(*rcoll) + num_rules * sizeof(__be32),
country->reg_collection_ptr);
- NLA_PUT_STRING(msg, NL80211_ATTR_REG_ALPHA2, (char *) country->alpha2);
+ NLA_PUT_STRING(msg, NL80211_ATTR_REG_ALPHA2, alpha2);
nl_reg_rules = nla_nest_start(msg, NL80211_ATTR_REG_RULES);
if (!nl_reg_rules) {
return 0;
}
-/* Avoid stdlib */
-static inline int is_len_2(const char *alpha2)
-{
- if (alpha2[0] == '\0' || (alpha2[1] == '\0'))
- return 0;
- if (alpha2[2] == '\0')
- return 1;
- return 0;
-}
-
static inline int is_valid_regdom(const char *alpha2)
{
- if (!is_len_2(alpha2))
- return 0;
-
if (!is_alpha2(alpha2) && !is_world_regdom(alpha2))
return 0;