Coverage Report

Created: 2025-07-23 06:13

/src/avahi/fuzz/fuzz-domain.c
Line
Count
Source (jump to first uncovered line)
1
/***
2
  This file is part of avahi.
3
4
  avahi is free software; you can redistribute it and/or modify it
5
  under the terms of the GNU Lesser General Public License as
6
  published by the Free Software Foundation; either version 2.1 of the
7
  License, or (at your option) any later version.
8
9
  avahi is distributed in the hope that it will be useful, but WITHOUT
10
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11
  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
12
  Public License for more details.
13
14
  You should have received a copy of the GNU Lesser General Public
15
  License along with avahi; if not, write to the Free Software
16
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17
  USA.
18
***/
19
20
#include <assert.h>
21
#include <stdint.h>
22
#include <string.h>
23
24
#include "avahi-common/alternative.h"
25
#include "avahi-common/malloc.h"
26
#include "avahi-common/domain.h"
27
28
29
934
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
30
934
    char *s = NULL, *t = NULL;
31
32
934
    if(!(s = avahi_malloc(size+1)))
33
0
        return 0;
34
35
934
    memcpy(s, data, size);
36
934
    s[size] = '\0';
37
38
934
    if ((t = avahi_normalize_name_strdup(s)))
39
674
        assert(avahi_domain_equal(s, t));
40
41
934
    avahi_is_valid_service_type_generic(s);
42
934
    avahi_is_valid_service_type_strict(s);
43
934
    avahi_is_valid_service_subtype(s);
44
934
    avahi_is_valid_domain_name(s);
45
934
    avahi_is_valid_service_name(s);
46
934
    avahi_is_valid_host_name(s);
47
934
    avahi_is_valid_fqdn(s);
48
49
934
    avahi_free(avahi_alternative_host_name(s));
50
934
    avahi_free(avahi_alternative_service_name(s));
51
52
934
    avahi_free(t);
53
934
    avahi_free(s);
54
55
934
    return 0;
56
934
}