MFC: An off-by-one malloc size was corrupting the installer's memory,
[dragonfly.git] / contrib / hostapd-0.5.8 / ieee802_11h.c
blob215e377da552187b41e133ef1689288bbce34a04
1 /*
2 * hostapd / IEEE 802.11h
3 * Copyright (c) 2005-2006, Devicescape Software, Inc.
4 * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * Alternatively, this software may be distributed under the terms of BSD
11 * license.
13 * See README and COPYING for more details.
16 #include "includes.h"
18 #include "hostapd.h"
21 int hostapd_check_power_cap(struct hostapd_data *hapd, u8 *power, u8 len)
23 unsigned int max_pwr;
25 if (len < 2) {
26 HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL,
27 "Too short power capability IE\n");
28 return -1;
30 max_pwr = power[1];
31 if (max_pwr > hapd->iface->sta_max_power)
32 return -1;
33 return 0;