Coverage Report

Created: 2025-11-06 06:43

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ndpi/fuzz/fuzz_is_stun_tcp.c
Line
Count
Source
1
#include "ndpi_api.h"
2
#include "ndpi_private.h"
3
#include "fuzz_common_code.h"
4
5
static struct ndpi_detection_module_struct *ndpi_struct = NULL;
6
static struct ndpi_flow_struct ndpi_flow;
7
struct ndpi_iphdr iph;
8
#ifdef STUN_TCP
9
struct ndpi_tcphdr tcph;
10
#else
11
struct ndpi_udphdr udph;
12
#endif
13
14
23.9k
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
15
23.9k
  u_int16_t app_proto; /* unused */
16
23.9k
  struct ndpi_packet_struct *packet;
17
23.9k
  ndpi_protocol_category_t category;
18
19
23.9k
  if (ndpi_struct == NULL) {
20
3
    fuzz_init_detection_module(&ndpi_struct, NULL);
21
3
  }
22
23
23.9k
  packet = &ndpi_struct->packet;
24
23.9k
  packet->payload = data;
25
23.9k
  packet->payload_packet_len = size;
26
#ifndef STUN_TCP
27
  packet->udp = &udph;
28
#else
29
23.9k
  packet->tcp = &tcph;
30
23.9k
#endif
31
23.9k
  packet->iph = &iph; /* IPv4 only */
32
33
23.9k
  is_stun(ndpi_struct, &ndpi_flow, &app_proto, &category);
34
23.9k
  return 0;
35
23.9k
}