Coverage Report

Created: 2026-11-12 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ntpsec/fuzz/setup.c
Line
Count
Source
1
/*
2
 * setup.c - stubs and glue shared by the OSS-Fuzz harnesses in this directory
3
 * Copyright the NTPsec project contributors
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#include <stdio.h>
8
#include <stdlib.h>
9
#include <string.h>
10
#include "ntpd.h"
11
#include "ntp_dns.h"
12
13
const char *progname = "ntpsecfuzz";
14
15
/* Hack to keep linker happy */
16
uint16_t extra_port = 0;
17
struct peer *peer_list = NULL;
18
19
void dns_take_server(struct peer *a, sockaddr_u *b);
20
void dns_take_status(struct peer *a, DNS_Status b);
21
void dns_take_pool(struct peer *a, sockaddr_u *b);
22
23
0
void dns_take_server(struct peer *a, sockaddr_u *b) {
24
0
  UNUSED_ARG(a);
25
0
  UNUSED_ARG(b);
26
0
  return;
27
0
}
28
29
0
void dns_take_status(struct peer *a, DNS_Status b) {
30
0
  UNUSED_ARG(a);
31
0
  UNUSED_ARG(b);
32
0
  return;
33
0
}
34
35
0
void dns_take_pool(struct peer *a, sockaddr_u *b) {
36
0
  UNUSED_ARG(a);
37
0
  UNUSED_ARG(b);
38
0
  return;
39
0
}
40
41
/* Stub the only daemon symbol the NTS parsers reference, to avoid pulling
42
 * ntp_util/ntp_filegen/ntp_control out of libntpd_lib.a */
43
void record_ntske_log(NTSKE_Status tag, const char *from, const char *msg,
44
          double wall, double usr, double sys, int aead,
45
          const char *errbuf)
46
0
{
47
0
  UNUSED_ARG(tag); UNUSED_ARG(from); UNUSED_ARG(msg);
48
0
  UNUSED_ARG(wall); UNUSED_ARG(usr); UNUSED_ARG(sys);
49
0
  UNUSED_ARG(aead); UNUSED_ARG(errbuf);
50
0
  return;
51
0
}
52
53
/* Keep fuzzed responses from triggering real DNS lookups inside
54
 * nts_client.c (see OSS-Fuzz issue 471591901).  The FuzzClient link
55
 * passes -Wl,--wrap=nts_server_lookup so calls to nts_server_lookup()
56
 * land here.  It is named __wrap_* because nts_client.o does get pulled
57
 * out of libntpd_lib.a, so a same-named stub would collide with it. */
58
bool __wrap_nts_server_lookup(char *server, sockaddr_u *addr, int af);
59
60
bool __wrap_nts_server_lookup(char *server, sockaddr_u *addr, int af)
61
0
{
62
0
  UNUSED_ARG(server); UNUSED_ARG(addr); UNUSED_ARG(af);
63
  return false;
64
0
}