Coverage Report

Created: 2024-06-18 06:23

/src/hpn-ssh/regress/misc/fuzz-harness/authopt_fuzz.cc
Line
Count
Source (jump to first uncovered line)
1
#include <stddef.h>
2
#include <stdio.h>
3
#include <stdint.h>
4
#include <string.h>
5
#include <stdlib.h>
6
7
extern "C" {
8
9
#include "auth-options.h"
10
11
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
12
1.84k
{
13
1.84k
  char *cp = (char *)malloc(size + 1);
14
1.84k
  struct sshauthopt *opts = NULL, *merge = NULL, *add = sshauthopt_new();
15
16
1.84k
  if (cp == NULL || add == NULL)
17
0
    goto out;
18
1.84k
  memcpy(cp, data, size);
19
1.84k
  cp[size] = '\0';
20
1.84k
  if ((opts = sshauthopt_parse(cp, NULL)) == NULL)
21
1.19k
    goto out;
22
647
  if ((merge = sshauthopt_merge(opts, add, NULL)) == NULL)
23
0
    goto out;
24
25
1.84k
 out:
26
1.84k
  free(cp);
27
1.84k
  sshauthopt_free(add);
28
1.84k
  sshauthopt_free(opts);
29
1.84k
  sshauthopt_free(merge);
30
1.84k
  return 0;
31
647
}
32
33
} // extern "C"