add wifi_c_hid2d fuzz test

Signed-off-by: yiyajun <yiyajun@huawei.com>
This commit is contained in:
yiyajun 2022-11-18 10:52:35 +08:00
parent 9d36a2322f
commit e9d63b116a
3 changed files with 9 additions and 9 deletions

View File

@ -20,7 +20,7 @@ module_output_path = "wifi/wifi_sta"
##############################fuzztest##########################################
ohos_fuzztest("WifiCHid2dFuzzTest") {
module_out_path = module_output_path
fuzz_config_file = "$WIFI_ROOT_DIR/test/fuzztest/wifi_sta/wifichid2d_fuzzer"
fuzz_config_file = "$WIFI_ROOT_DIR/test/fuzztest/frameworks/native/c_adapter/wifichid2d_fuzzer"
include_dirs = [
"$WIFI_ROOT_DIR/frameworks/native/include",

View File

@ -14,8 +14,8 @@
*/
#include "wifichid2d_fuzzer.h"
#include <stdint.h>
#include "../../../../interfaces/kits/c/wifi_hid2d.h"
#include "wifi_hid2d.h"
#include "../../../../../../interfaces/kits/c/wifi_hid2d.h"
namespace OHOS {
namespace Wifi {
@ -50,7 +50,7 @@ void Hid2dRequestGcIpTest(const uint8_t* data, size_t size)
}
for (int i = 0; i < IPLEN; i++) {
ipAddr[i] = static_cast<int> (data[i]);
ipAddr[i] = static_cast<int>(data[i]);
}
}
@ -72,7 +72,7 @@ void Hid2dCreateGroupTest(const uint8_t* data, size_t size)
{
unsigned int index = 0;
WifiErrorCode Hid2dCreateGroup(const int frequency, FreqType type)
int frequency = static_cast<int> (data[index++]);
int frequency = static_cast<int>(data[index++]);
FreqType type = FREQUENCY_DEFAULT;
if (data[index++] > VALUE) {
type = FREQUENCY_160M;
@ -144,7 +144,7 @@ void Hid2dGetRecommendChannelTest(const uint8_t* data, size_t size)
response->index = static_cast<int> (data[index++]);
response->centerFreq = static_cast<int> (data[index++]);
response->centerFreq1 = static_cast<int> (data[index++]);
response->centerFreq2 = static_cast<int> (data[index++]);
response->centerFreq2 = static_cast<int> (data[index++]);
(void)Hid2dGetRecommendChannel(nullptr, nullptr);
}
@ -170,7 +170,7 @@ void Hid2dGetSelfWifiCfgInfoTest(const uint8_t* data, size_t size)
void Hid2dSetPeerWifiCfgInfoTest(const uint8_t* data, size_t size)
{
PeerCfgType cfgType = TYPE_OF_SET_PEER_CONFIG;
int setDataValidLen = static_cast<int> (data[0]);
int setDataValidLen = static_cast<int>(data[0]);
char cfgData[DATA_MAX_BYTES] = {0};
if (memcpy_s(cfgData, DATA_MAX_BYTES, data, size) != EOK) {

View File

@ -16,6 +16,8 @@
#ifndef WIFI_C_HID2D__H
#define WIFI_C_HID2D__H
#include <stdint.h>
#define FUZZ_PROJECT_NAME "wifichid2d_fuzzer"
#define MACLEN 6
#define IPLEN 4
@ -24,7 +26,6 @@
#define DATA_MAX_BYTES
void Hid2dRequestGcIpTest(const uint8_t* data, size_t size);
/*
void Hid2dSharedlinkIncreaseTest(void);
void Hid2dSharedlinkDecreaseTest(void);
void Hid2dCreateGroupTest(const uint8_t* data, size_t size);
@ -38,6 +39,5 @@ void Hid2dGetSelfWifiCfgInfoTest(const uint8_t* data, size_t size);
void Hid2dSetPeerWifiCfgInfoTest(const uint8_t* data, size_t size);
void Hid2dIsWideBandwidthSupportedTest(void);
void Hid2dSetUpperSceneTest(const uint8_t* data, size_t size);
*/
#endif