mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-29 18:27:31 +02:00
CI: fixing the files to be complient with pre-commit hooks
This commit is contained in:
@ -39,7 +39,7 @@ The rest of the document will refer to that folder as ```PATH_TO_AFL```.
|
||||
```
|
||||
|
||||
- On Ubuntu you need the following packages:
|
||||
|
||||
|
||||
```bash
|
||||
sudo apt-get install make clang-4.0(or <=4.0) llvm-4.0(or <=4.0) libbsd-dev
|
||||
```
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
@ -5,22 +10,22 @@
|
||||
#include <unistd.h>
|
||||
#include "esp32_mock.h"
|
||||
|
||||
void* g_queue;
|
||||
void *g_queue;
|
||||
int g_queue_send_shall_fail = 0;
|
||||
int g_size = 0;
|
||||
|
||||
const char * WIFI_EVENT = "wifi_event";
|
||||
const char * ETH_EVENT = "eth_event";
|
||||
const char *WIFI_EVENT = "wifi_event";
|
||||
const char *ETH_EVENT = "eth_event";
|
||||
|
||||
esp_err_t esp_event_handler_register(const char * event_base,
|
||||
int32_t event_id,
|
||||
void* event_handler,
|
||||
void* event_handler_arg)
|
||||
esp_err_t esp_event_handler_register(const char *event_base,
|
||||
int32_t event_id,
|
||||
void *event_handler,
|
||||
void *event_handler_arg)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_event_handler_unregister(const char * event_base, int32_t event_id, void* event_handler)
|
||||
esp_err_t esp_event_handler_unregister(const char *event_base, int32_t event_id, void *event_handler)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
@ -40,8 +45,8 @@ esp_err_t esp_timer_start_periodic(esp_timer_handle_t timer, uint64_t period)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_timer_create(const esp_timer_create_args_t* create_args,
|
||||
esp_timer_handle_t* out_handle)
|
||||
esp_err_t esp_timer_create(const esp_timer_create_args_t *create_args,
|
||||
esp_timer_handle_t *out_handle)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
@ -53,12 +58,12 @@ uint32_t xTaskGetTickCount(void)
|
||||
}
|
||||
|
||||
/// Queue mock
|
||||
QueueHandle_t xQueueCreate( uint32_t uxQueueLength, uint32_t uxItemSize )
|
||||
{
|
||||
g_size = uxItemSize;
|
||||
g_queue = malloc((uxQueueLength)*(uxItemSize));
|
||||
return g_queue;
|
||||
}
|
||||
QueueHandle_t xQueueCreate( uint32_t uxQueueLength, uint32_t uxItemSize )
|
||||
{
|
||||
g_size = uxItemSize;
|
||||
g_queue = malloc((uxQueueLength) * (uxItemSize));
|
||||
return g_queue;
|
||||
}
|
||||
|
||||
|
||||
void vQueueDelete( QueueHandle_t xQueue )
|
||||
@ -66,14 +71,11 @@ void vQueueDelete( QueueHandle_t xQueue )
|
||||
free(xQueue);
|
||||
}
|
||||
|
||||
uint32_t xQueueSend(QueueHandle_t xQueue, const void * pvItemToQueue, TickType_t xTicksToWait)
|
||||
uint32_t xQueueSend(QueueHandle_t xQueue, const void *pvItemToQueue, TickType_t xTicksToWait)
|
||||
{
|
||||
if (g_queue_send_shall_fail)
|
||||
{
|
||||
if (g_queue_send_shall_fail) {
|
||||
return pdFALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
memcpy(xQueue, pvItemToQueue, g_size);
|
||||
return pdPASS;
|
||||
}
|
||||
@ -105,7 +107,7 @@ void xTaskNotifyGive(TaskHandle_t task)
|
||||
return;
|
||||
}
|
||||
|
||||
BaseType_t xTaskNotifyWait(uint32_t bits_entry_clear, uint32_t bits_exit_clear, uint32_t * value, TickType_t wait_time)
|
||||
BaseType_t xTaskNotifyWait(uint32_t bits_entry_clear, uint32_t bits_exit_clear, uint32_t *value, TickType_t wait_time)
|
||||
{
|
||||
return pdTRUE;
|
||||
}
|
||||
|
@ -40,8 +40,8 @@
|
||||
|
||||
#define pdTRUE true
|
||||
#define pdFALSE false
|
||||
#define pdPASS ( pdTRUE )
|
||||
#define pdFAIL ( pdFALSE )
|
||||
#define pdPASS ( pdTRUE )
|
||||
#define pdFAIL ( pdFALSE )
|
||||
|
||||
#define portMAX_DELAY 0xFFFFFFFF
|
||||
#define portTICK_PERIOD_MS 1
|
||||
@ -80,45 +80,45 @@
|
||||
|
||||
typedef int32_t esp_err_t;
|
||||
|
||||
typedef void * SemaphoreHandle_t;
|
||||
typedef void * QueueHandle_t;
|
||||
typedef void * TaskHandle_t;
|
||||
typedef void *SemaphoreHandle_t;
|
||||
typedef void *QueueHandle_t;
|
||||
typedef void *TaskHandle_t;
|
||||
typedef int BaseType_t;
|
||||
typedef uint32_t TickType_t;
|
||||
|
||||
|
||||
extern const char * WIFI_EVENT;
|
||||
extern const char * IP_EVENT;
|
||||
extern const char * ETH_EVENT;
|
||||
extern const char *WIFI_EVENT;
|
||||
extern const char *IP_EVENT;
|
||||
extern const char *ETH_EVENT;
|
||||
|
||||
struct udp_pcb {
|
||||
uint8_t dummy;
|
||||
};
|
||||
|
||||
struct ip4_addr {
|
||||
uint32_t addr;
|
||||
uint32_t addr;
|
||||
};
|
||||
typedef struct ip4_addr ip4_addr_t;
|
||||
|
||||
struct ip6_addr {
|
||||
uint32_t addr[4];
|
||||
uint32_t addr[4];
|
||||
};
|
||||
typedef struct ip6_addr ip6_addr_t;
|
||||
|
||||
typedef void* system_event_t;
|
||||
typedef void *system_event_t;
|
||||
|
||||
struct pbuf {
|
||||
struct pbuf *next;
|
||||
void *payload;
|
||||
uint16_t tot_len;
|
||||
uint16_t len;
|
||||
uint8_t /*pbuf_type*/ type;
|
||||
uint8_t flags;
|
||||
uint16_t ref;
|
||||
struct pbuf *next;
|
||||
void *payload;
|
||||
uint16_t tot_len;
|
||||
uint16_t len;
|
||||
uint8_t /*pbuf_type*/ type;
|
||||
uint8_t flags;
|
||||
uint16_t ref;
|
||||
};
|
||||
|
||||
uint32_t xTaskGetTickCount(void);
|
||||
typedef void (*esp_timer_cb_t)(void* arg);
|
||||
typedef void (*esp_timer_cb_t)(void *arg);
|
||||
|
||||
// Queue mock
|
||||
QueueHandle_t xQueueCreate( uint32_t uxQueueLength,
|
||||
@ -126,7 +126,7 @@ QueueHandle_t xQueueCreate( uint32_t uxQueueLength,
|
||||
|
||||
void vQueueDelete( QueueHandle_t xQueue );
|
||||
|
||||
uint32_t xQueueSend(QueueHandle_t xQueue, const void * pvItemToQueue, TickType_t xTicksToWait);
|
||||
uint32_t xQueueSend(QueueHandle_t xQueue, const void *pvItemToQueue, TickType_t xTicksToWait);
|
||||
|
||||
uint32_t xQueueReceive(QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait);
|
||||
|
||||
@ -134,9 +134,9 @@ void GetLastItem(void *pvBuffer);
|
||||
|
||||
void ForceTaskDelete(void);
|
||||
|
||||
esp_err_t esp_event_handler_register(const char * event_base, int32_t event_id, void* event_handler, void* event_handler_arg);
|
||||
esp_err_t esp_event_handler_register(const char *event_base, int32_t event_id, void *event_handler, void *event_handler_arg);
|
||||
|
||||
esp_err_t esp_event_handler_unregister(const char * event_base, int32_t event_id, void* event_handler);
|
||||
esp_err_t esp_event_handler_unregister(const char *event_base, int32_t event_id, void *event_handler);
|
||||
|
||||
|
||||
TaskHandle_t xTaskGetCurrentTaskHandle(void);
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
#pragma once
|
||||
#define IRAM_ATTR
|
||||
#define FLAG_ATTR(TYPE)
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2020 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -24,7 +16,7 @@ typedef struct esp_netif_ip_info esp_netif_ip_info_t;
|
||||
typedef struct esp_netif_dhcp_status esp_netif_dhcp_status_t;
|
||||
|
||||
|
||||
const char * IP_EVENT = "IP_EVENT";
|
||||
const char *IP_EVENT = "IP_EVENT";
|
||||
|
||||
|
||||
esp_err_t esp_netif_add_to_list(esp_netif_t *netif)
|
||||
@ -37,12 +29,12 @@ esp_err_t esp_netif_remove_from_list(esp_netif_t *netif)
|
||||
return ESP_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
esp_netif_t* esp_netif_next(esp_netif_t* netif)
|
||||
esp_netif_t *esp_netif_next(esp_netif_t *netif)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
esp_netif_t* esp_netif_next_unsafe(esp_netif_t* netif)
|
||||
esp_netif_t *esp_netif_next_unsafe(esp_netif_t *netif)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
/*
|
||||
* MDNS Dependecy injection -- preincluded to inject interface test functions into static variables
|
||||
*
|
||||
@ -7,19 +12,19 @@
|
||||
#include "mdns_private.h"
|
||||
|
||||
void (*mdns_test_static_execute_action)(mdns_action_t *) = NULL;
|
||||
mdns_srv_item_t * (*mdns_test_static_mdns_get_service_item)(const char * service, const char * proto, const char *hostname) = NULL;
|
||||
mdns_srv_item_t *(*mdns_test_static_mdns_get_service_item)(const char *service, const char *proto, const char *hostname) = NULL;
|
||||
mdns_search_once_t *(*mdns_test_static_search_init)(const char *name, const char *service, const char *proto, uint16_t type, bool unicast,
|
||||
uint32_t timeout, uint8_t max_results,
|
||||
mdns_query_notify_t notifier) = NULL;
|
||||
esp_err_t (*mdns_test_static_send_search_action)(mdns_action_type_t type, mdns_search_once_t * search) = NULL;
|
||||
void (*mdns_test_static_search_free)(mdns_search_once_t * search) = NULL;
|
||||
uint32_t timeout, uint8_t max_results,
|
||||
mdns_query_notify_t notifier) = NULL;
|
||||
esp_err_t (*mdns_test_static_send_search_action)(mdns_action_type_t type, mdns_search_once_t *search) = NULL;
|
||||
void (*mdns_test_static_search_free)(mdns_search_once_t *search) = NULL;
|
||||
|
||||
static void _mdns_execute_action(mdns_action_t * action);
|
||||
static mdns_srv_item_t * _mdns_get_service_item(const char * service, const char * proto, const char *hostname);
|
||||
static void _mdns_execute_action(mdns_action_t *action);
|
||||
static mdns_srv_item_t *_mdns_get_service_item(const char *service, const char *proto, const char *hostname);
|
||||
static mdns_search_once_t *_mdns_search_init(const char *name, const char *service, const char *proto, uint16_t type, bool unicast,
|
||||
uint32_t timeout, uint8_t max_results, mdns_query_notify_t notifier);
|
||||
static esp_err_t _mdns_send_search_action(mdns_action_type_t type, mdns_search_once_t * search);
|
||||
static void _mdns_search_free(mdns_search_once_t * search);
|
||||
uint32_t timeout, uint8_t max_results, mdns_query_notify_t notifier);
|
||||
static esp_err_t _mdns_send_search_action(mdns_action_type_t type, mdns_search_once_t *search);
|
||||
static void _mdns_search_free(mdns_search_once_t *search);
|
||||
|
||||
void mdns_test_init_di(void)
|
||||
{
|
||||
@ -30,27 +35,27 @@ void mdns_test_init_di(void)
|
||||
mdns_test_static_search_free = _mdns_search_free;
|
||||
}
|
||||
|
||||
void mdns_test_execute_action(void * action)
|
||||
void mdns_test_execute_action(void *action)
|
||||
{
|
||||
mdns_test_static_execute_action((mdns_action_t *)action);
|
||||
}
|
||||
|
||||
void mdns_test_search_free(mdns_search_once_t * search)
|
||||
void mdns_test_search_free(mdns_search_once_t *search)
|
||||
{
|
||||
return mdns_test_static_search_free(search);
|
||||
}
|
||||
|
||||
esp_err_t mdns_test_send_search_action(mdns_action_type_t type, mdns_search_once_t * search)
|
||||
esp_err_t mdns_test_send_search_action(mdns_action_type_t type, mdns_search_once_t *search)
|
||||
{
|
||||
return mdns_test_static_send_search_action(type, search);
|
||||
}
|
||||
|
||||
mdns_search_once_t * mdns_test_search_init(const char * name, const char * service, const char * proto, uint16_t type, uint32_t timeout, uint8_t max_results)
|
||||
mdns_search_once_t *mdns_test_search_init(const char *name, const char *service, const char *proto, uint16_t type, uint32_t timeout, uint8_t max_results)
|
||||
{
|
||||
return mdns_test_static_search_init(name, service, proto, type, timeout, type != MDNS_TYPE_PTR, max_results, NULL);
|
||||
}
|
||||
|
||||
mdns_srv_item_t * mdns_test_mdns_get_service_item(const char * service, const char * proto)
|
||||
mdns_srv_item_t *mdns_test_mdns_get_service_item(const char *service, const char *proto)
|
||||
{
|
||||
return mdns_test_static_mdns_get_service_item(service, proto, NULL);
|
||||
}
|
||||
|
@ -1,10 +1,15 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
#pragma once
|
||||
#include "esp32_mock.h"
|
||||
#include "mdns.h"
|
||||
#include "mdns_private.h"
|
||||
|
||||
|
||||
static inline void* _mdns_get_packet_data(mdns_rx_packet_t *packet)
|
||||
static inline void *_mdns_get_packet_data(mdns_rx_packet_t *packet)
|
||||
{
|
||||
return packet->pb->payload;
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
/*
|
||||
* This config file commited in order to not run `idf.py reconfigure` each time when running fuzzer test. You can modify it manually or run `idf.py reconfigure` to generate new one if needed.
|
||||
* Espressif IoT Development Framework (ESP-IDF) Configuration Header
|
||||
|
@ -18,73 +18,73 @@
|
||||
// Global stuctures containing packet payload, search
|
||||
mdns_rx_packet_t g_packet;
|
||||
struct pbuf mypbuf;
|
||||
mdns_search_once_t * search = NULL;
|
||||
mdns_search_once_t *search = NULL;
|
||||
|
||||
//
|
||||
// Dependency injected test functions
|
||||
void mdns_test_execute_action(void * action);
|
||||
mdns_srv_item_t * mdns_test_mdns_get_service_item(const char * service, const char * proto);
|
||||
mdns_search_once_t * mdns_test_search_init(const char * name, const char * service, const char * proto, uint16_t type, uint32_t timeout, uint8_t max_results);
|
||||
esp_err_t mdns_test_send_search_action(mdns_action_type_t type, mdns_search_once_t * search);
|
||||
void mdns_test_search_free(mdns_search_once_t * search);
|
||||
void mdns_test_execute_action(void *action);
|
||||
mdns_srv_item_t *mdns_test_mdns_get_service_item(const char *service, const char *proto);
|
||||
mdns_search_once_t *mdns_test_search_init(const char *name, const char *service, const char *proto, uint16_t type, uint32_t timeout, uint8_t max_results);
|
||||
esp_err_t mdns_test_send_search_action(mdns_action_type_t type, mdns_search_once_t *search);
|
||||
void mdns_test_search_free(mdns_search_once_t *search);
|
||||
void mdns_test_init_di(void);
|
||||
extern mdns_server_t * _mdns_server;
|
||||
extern mdns_server_t *_mdns_server;
|
||||
|
||||
//
|
||||
// mdns function wrappers for mdns setup in test mode
|
||||
static int mdns_test_hostname_set(const char * mdns_hostname)
|
||||
static int mdns_test_hostname_set(const char *mdns_hostname)
|
||||
{
|
||||
for (int i=0; i<MDNS_MAX_INTERFACES; i++) {
|
||||
for (int i = 0; i < MDNS_MAX_INTERFACES; i++) {
|
||||
_mdns_server->interfaces[i].pcbs[MDNS_IP_PROTOCOL_V4].state = PCB_RUNNING; // mark the PCB running to exercise mdns in fully operational mode
|
||||
_mdns_server->interfaces[i].pcbs[MDNS_IP_PROTOCOL_V6].state = PCB_RUNNING;
|
||||
}
|
||||
int ret = mdns_hostname_set(mdns_hostname);
|
||||
mdns_action_t * a = NULL;
|
||||
mdns_action_t *a = NULL;
|
||||
GetLastItem(&a);
|
||||
mdns_test_execute_action(a);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mdns_test_add_delegated_host(const char * mdns_hostname)
|
||||
static int mdns_test_add_delegated_host(const char *mdns_hostname)
|
||||
{
|
||||
mdns_ip_addr_t addr = { .addr = { .u_addr = ESP_IPADDR_TYPE_V4 } };
|
||||
addr.addr.u_addr.ip4.addr = 0x11111111;
|
||||
int ret = mdns_delegate_hostname_add(mdns_hostname, &addr);
|
||||
mdns_action_t * a = NULL;
|
||||
mdns_action_t *a = NULL;
|
||||
GetLastItem(&a);
|
||||
mdns_test_execute_action(a);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int mdns_test_service_instance_name_set(const char * service, const char * proto, const char * instance)
|
||||
static int mdns_test_service_instance_name_set(const char *service, const char *proto, const char *instance)
|
||||
{
|
||||
int ret = mdns_service_instance_name_set(service, proto, instance);
|
||||
mdns_action_t * a = NULL;
|
||||
mdns_action_t *a = NULL;
|
||||
GetLastItem(&a);
|
||||
mdns_test_execute_action(a);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mdns_test_service_txt_set(const char * service, const char * proto, uint8_t num_items, mdns_txt_item_t txt[])
|
||||
static int mdns_test_service_txt_set(const char *service, const char *proto, uint8_t num_items, mdns_txt_item_t txt[])
|
||||
{
|
||||
int ret = mdns_service_txt_set(service, proto, txt, num_items);
|
||||
mdns_action_t * a = NULL;
|
||||
mdns_action_t *a = NULL;
|
||||
GetLastItem(&a);
|
||||
mdns_test_execute_action(a);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mdns_test_sub_service_add(const char * sub_name, const char * service_name, const char * proto, uint32_t port)
|
||||
static int mdns_test_sub_service_add(const char *sub_name, const char *service_name, const char *proto, uint32_t port)
|
||||
{
|
||||
if (mdns_service_add(NULL, service_name, proto, port, NULL, 0)) {
|
||||
// This is expected failure as the service thread is not running
|
||||
}
|
||||
mdns_action_t * a = NULL;
|
||||
mdns_action_t *a = NULL;
|
||||
GetLastItem(&a);
|
||||
mdns_test_execute_action(a);
|
||||
|
||||
if (mdns_test_mdns_get_service_item(service_name, proto)==NULL) {
|
||||
if (mdns_test_mdns_get_service_item(service_name, proto) == NULL) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
int ret = mdns_service_subtype_add_for_host(NULL, service_name, proto, NULL, sub_name);
|
||||
@ -94,22 +94,22 @@ static int mdns_test_sub_service_add(const char * sub_name, const char * service
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mdns_test_service_add(const char * service_name, const char * proto, uint32_t port)
|
||||
static int mdns_test_service_add(const char *service_name, const char *proto, uint32_t port)
|
||||
{
|
||||
if (mdns_service_add(NULL, service_name, proto, port, NULL, 0)) {
|
||||
// This is expected failure as the service thread is not running
|
||||
}
|
||||
mdns_action_t * a = NULL;
|
||||
mdns_action_t *a = NULL;
|
||||
GetLastItem(&a);
|
||||
mdns_test_execute_action(a);
|
||||
|
||||
if (mdns_test_mdns_get_service_item(service_name, proto)==NULL) {
|
||||
if (mdns_test_mdns_get_service_item(service_name, proto) == NULL) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static mdns_result_t* mdns_test_query(const char * name, const char * service, const char * proto, uint16_t type)
|
||||
static mdns_result_t *mdns_test_query(const char *name, const char *service, const char *proto, uint16_t type)
|
||||
{
|
||||
search = mdns_test_search_init(name, service, proto, type, 3000, 20);
|
||||
if (!search) {
|
||||
@ -121,7 +121,7 @@ static mdns_result_t* mdns_test_query(const char * name, const char * service, c
|
||||
abort();
|
||||
}
|
||||
|
||||
mdns_action_t * a = NULL;
|
||||
mdns_action_t *a = NULL;
|
||||
GetLastItem(&a);
|
||||
mdns_test_execute_action(a);
|
||||
return NULL;
|
||||
@ -135,27 +135,27 @@ static void mdns_test_query_free(void)
|
||||
//
|
||||
// function "under test" where afl-mangled packets passed
|
||||
//
|
||||
void mdns_parse_packet(mdns_rx_packet_t * packet);
|
||||
void mdns_parse_packet(mdns_rx_packet_t *packet);
|
||||
|
||||
//
|
||||
// Test starts here
|
||||
//
|
||||
int main(int argc, char** argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
const char * mdns_hostname = "minifritz";
|
||||
const char * mdns_instance = "Hristo's Time Capsule";
|
||||
const char *mdns_hostname = "minifritz";
|
||||
const char *mdns_instance = "Hristo's Time Capsule";
|
||||
mdns_txt_item_t arduTxtData[4] = {
|
||||
{"board","esp32"},
|
||||
{"tcp_check","no"},
|
||||
{"ssh_upload","no"},
|
||||
{"auth_upload","no"}
|
||||
{"board", "esp32"},
|
||||
{"tcp_check", "no"},
|
||||
{"ssh_upload", "no"},
|
||||
{"auth_upload", "no"}
|
||||
};
|
||||
|
||||
const uint8_t mac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x32};
|
||||
|
||||
uint8_t buf[1460];
|
||||
char winstance[21+strlen(mdns_hostname)];
|
||||
char winstance[21 + strlen(mdns_hostname)];
|
||||
|
||||
sprintf(winstance, "%s [%02x:%02x:%02x:%02x:%02x:%02x]", mdns_hostname, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
|
||||
@ -208,7 +208,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
if (
|
||||
mdns_test_service_add("_afpovertcp", "_tcp", 548)
|
||||
mdns_test_service_add("_afpovertcp", "_tcp", 548)
|
||||
|| mdns_test_service_add("_rfb", "_tcp", 885)
|
||||
|| mdns_test_service_add("_smb", "_tcp", 885)
|
||||
|| mdns_test_service_add("_adisk", "_tcp", 885)
|
||||
@ -224,12 +224,11 @@ int main(int argc, char** argv)
|
||||
|| mdns_test_service_add("_ipps", "_tcp", 885)
|
||||
|| mdns_test_service_add("_pdl-datastream", "_tcp", 885)
|
||||
|| mdns_test_service_add("_ptp", "_tcp", 885)
|
||||
|| mdns_test_service_add("_sleep-proxy", "_udp", 885))
|
||||
{
|
||||
|| mdns_test_service_add("_sleep-proxy", "_udp", 885)) {
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
mdns_result_t * results = NULL;
|
||||
mdns_result_t *results = NULL;
|
||||
FILE *file;
|
||||
size_t nread;
|
||||
|
||||
@ -237,13 +236,10 @@ int main(int argc, char** argv)
|
||||
size_t len = 1460;
|
||||
memset(buf, 0, 1460);
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
if (argc != 2) {
|
||||
printf("Non-instrumentation mode: please supply a file name created by AFL to reproduce crash\n");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//
|
||||
// Note: parameter1 is a file (mangled packet) which caused the crash
|
||||
file = fopen(argv[1], "r");
|
||||
@ -252,7 +248,7 @@ int main(int argc, char** argv)
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
for (i=0; i<1; i++) {
|
||||
for (i = 0; i < 1; i++) {
|
||||
#else
|
||||
while (__AFL_LOOP(1000)) {
|
||||
memset(buf, 0, 1460);
|
||||
|
Reference in New Issue
Block a user