<commit_before>/****************************************************************************
*
* Copyright (c) 2015 Wi-Fi Alliance
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
* USE OR PERFORMANCE OF THIS SOFTWARE.
*
*****************************************************************************/

/*
 * wfa_cmds.h:
 *   definitions of command types.
 */
#ifndef _WFA_CMDS_H
#define _WFA_CMDS_H

typedef struct _tg_ping_start
{
    char dipaddr[IPV6_ADDRESS_STRING_LEN];  /* destination/remote ip address */
    int  frameSize;
    float  frameRate;
    int  duration;
    int  type;
    int  qos;
    int  iptype;
    int  dscp;
} tgPingStart_t;

typedef struct ca_sta_set_ip_config
{
    char intf[WFA_IF_NAME_LEN];
    int isDhcp;
    char ipaddr[WFA_IP_ADDR_STR_LEN];
    char mask[WFA_IP_MASK_STR_LEN];
    char defGateway[WFA_IP_ADDR_STR_LEN];
    char pri_dns[WFA_IP_ADDR_STR_LEN];
    char sec_dns[WFA_IP_ADDR_STR_LEN];
} caStaSetIpConfig_t;

typedef struct ca_sta_verify_ip_connection
{
    char dipaddr[WFA_IP_ADDR_STR_LEN];
    int timeout;
} caStaVerifyIpConnect_t;

typedef struct ca_sta_set_encryption
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    int encpType;
    char keys[4][32];  /* 26 hex */
    int activeKeyIdx;
} caStaSetEncryption_t;

typedef enum wfa_enableType
{
    eEnable = 1,
    eDisable
} wfaEnableType;

typedef struct ca_sta_set_mode
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char mode;
    int encpType;
    int channel;
    char keys[4][32];  /* 26 hex */
    int activeKeyIdx;
} caStaSetMode_t;

typedef struct ca_sta_set_psk
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    BYTE passphrase[64];
    char keyMgmtType[16];  /* WPA-PSK */
    int encpType;    /* TKIP    */
    int pmf;               /* PMF enable or disable */
    char micAlg[16];
    char prog[16];
    BOOL prefer;
} caStaSetPSK_t;

typedef struct ca_sta_set_eaptls
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char username[32];
    char keyMgmtType[8];
    char encrptype[9];
    char trustedRootCA[128];
    char clientCertificate[128];
    int pmf;               /* PMF enable or disable */
    char micAlg[16];
} caStaSetEapTLS_t;

typedef struct ca_sta_set_eapttls
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char username[32];
    char passwd[16];
    char keyMgmtType[8];
    char encrptype[9];
    char trustedRootCA[32];
    char clientCertificate[32];
    int pmf;               /* PMF enable or disable */
    char micAlg[16];
    char prog[16];
    BOOL prefer;
} caStaSetEapTTLS_t;

typedef struct ca_sta_set_eapsim
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char username[32];
    char passwd[96];
    char keyMgmtType[8];
    char encrptype[9];
    char	tripletCount;
    char tripletSet[3][64];
    int pmf;               /* PMF enable or disable */
} caStaSetEapSIM_t;

typedef struct ca_sta_set_eappeap
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char username[32];
    char passwd[16];
    char keyMgmtType[8];
    char encrptype[9];
    char trustedRootCA[32];
    char innerEAP[16];
    int peapVersion;
    int pmf;               /* PMF enable or disable */
} caStaSetEapPEAP_t;

typedef struct ca_sta_set_eapfast
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char username[32];
    char passwd[16];
    char keyMgmtType[8];
    char encrptype[9];
    char trustedRootCA[32];
    char innerEAP[16];
    char	validateServer;
    char pacFileName[32];
    int pmf;               /* PMF enable or disable */
} caStaSetEapFAST_t;

typedef struct ca_sta_set_eapaka
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char username[32];
    char passwd[96];
    char keyMgmtType[8];
    char encrptype[9];
    char	tripletCount;
    char tripletSet[3][96];
    int pmf;               /* PMF enable or disable */
} caStaSetEapAKA_t;

enum sectype {
    SEC_TYPE_PSK = 1,
    SEC_TYPE_EAPTLS,
    SEC_TYPE_EAPTTLS,
    SEC_TYPE_EAPPEAP,
    SEC_TYPE_EAPSIM,
    SEC_TYPE_EAPFAST,
    SEC_TYPE_EAPAKA,
};<commit_msg>Fix buffer overflow that can occur in sta_set_eapaka in WTS 9.0.0<commit_after>/****************************************************************************
*
* Copyright (c) 2015 Wi-Fi Alliance
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
* USE OR PERFORMANCE OF THIS SOFTWARE.
*
*****************************************************************************/

/*
 * wfa_cmds.h:
 *   definitions of command types.
 */
#ifndef _WFA_CMDS_H
#define _WFA_CMDS_H

typedef struct _tg_ping_start
{
    char dipaddr[IPV6_ADDRESS_STRING_LEN];  /* destination/remote ip address */
    int  frameSize;
    float  frameRate;
    int  duration;
    int  type;
    int  qos;
    int  iptype;
    int  dscp;
} tgPingStart_t;

typedef struct ca_sta_set_ip_config
{
    char intf[WFA_IF_NAME_LEN];
    int isDhcp;
    char ipaddr[WFA_IP_ADDR_STR_LEN];
    char mask[WFA_IP_MASK_STR_LEN];
    char defGateway[WFA_IP_ADDR_STR_LEN];
    char pri_dns[WFA_IP_ADDR_STR_LEN];
    char sec_dns[WFA_IP_ADDR_STR_LEN];
} caStaSetIpConfig_t;

typedef struct ca_sta_verify_ip_connection
{
    char dipaddr[WFA_IP_ADDR_STR_LEN];
    int timeout;
} caStaVerifyIpConnect_t;

typedef struct ca_sta_set_encryption
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    int encpType;
    char keys[4][32];  /* 26 hex */
    int activeKeyIdx;
} caStaSetEncryption_t;

typedef enum wfa_enableType
{
    eEnable = 1,
    eDisable
} wfaEnableType;

typedef struct ca_sta_set_mode
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char mode;
    int encpType;
    int channel;
    char keys[4][32];  /* 26 hex */
    int activeKeyIdx;
} caStaSetMode_t;

typedef struct ca_sta_set_psk
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    BYTE passphrase[64];
    char keyMgmtType[16];  /* WPA-PSK */
    int encpType;    /* TKIP    */
    int pmf;               /* PMF enable or disable */
    char micAlg[16];
    char prog[16];
    BOOL prefer;
} caStaSetPSK_t;

typedef struct ca_sta_set_eaptls
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char username[32];
    char keyMgmtType[8];
    char encrptype[9];
    char trustedRootCA[128];
    char clientCertificate[128];
    int pmf;               /* PMF enable or disable */
    char micAlg[16];
} caStaSetEapTLS_t;

typedef struct ca_sta_set_eapttls
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char username[32];
    char passwd[16];
    char keyMgmtType[8];
    char encrptype[9];
    char trustedRootCA[32];
    char clientCertificate[32];
    int pmf;               /* PMF enable or disable */
    char micAlg[16];
    char prog[16];
    BOOL prefer;
} caStaSetEapTTLS_t;

typedef struct ca_sta_set_eapsim
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char username[32];
    char passwd[96];
    char keyMgmtType[8];
    char encrptype[9];
    char	tripletCount;
    char tripletSet[3][64];
    int pmf;               /* PMF enable or disable */
} caStaSetEapSIM_t;

typedef struct ca_sta_set_eappeap
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char username[32];
    char passwd[16];
    char keyMgmtType[8];
    char encrptype[9];
    char trustedRootCA[32];
    char innerEAP[16];
    int peapVersion;
    int pmf;               /* PMF enable or disable */
} caStaSetEapPEAP_t;

typedef struct ca_sta_set_eapfast
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char username[32];
    char passwd[16];
    char keyMgmtType[8];
    char encrptype[9];
    char trustedRootCA[32];
    char innerEAP[16];
    char	validateServer;
    char pacFileName[32];
    int pmf;               /* PMF enable or disable */
} caStaSetEapFAST_t;

typedef struct ca_sta_set_eapaka
{
    char intf[WFA_IF_NAME_LEN];
    char ssid[WFA_SSID_NAME_LEN];
    char username[64];
    char passwd[96];
    char keyMgmtType[8];
    char encrptype[9];
    char	tripletCount;
    char tripletSet[3][96];
    int pmf;               /* PMF enable or disable */
} caStaSetEapAKA_t;

enum sectype {
    SEC_TYPE_PSK = 1,
    SEC_TYPE_EAPTLS,
    SEC_TYPE_EAPTTLS,
    SEC_TYPE_EAPPEAP,
    SEC_TYPE_EAPSIM,
    SEC_TYPE_EAPFAST,
    SEC_TYPE_EAPAKA,
};
{'fraction_non_alphanumeric': 0.11398427803061646, 'fraction_numerical': 0.019135291683905667, 'mean_word_length': 3.3810602628001813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '453576', 'n_tokens_mistral': 3717, 'n_tokens_neox': 3463, 'n_words': 858}