Coverage Report

Created: 2023-03-26 06:19

/src/fuzzer.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * ProFTPD - FTP server fuzzing testsuite
3
 * Copyright (c) 2021 The ProFTPD Project team
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 2 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18
 *
19
 * As a special exemption, The ProFTPD Project team and other respective
20
 * copyright holders give permission to link this program with OpenSSL, and
21
 * distribute the resulting executable, without including the source code for
22
 * OpenSSL in the source distribution.
23
 */
24
25
#include <stdint.h>
26
#include <string.h>
27
#include <stdlib.h>
28
#include "json.h"
29
30
1.62k
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size){        
31
1.62k
    char *new_str = (char *)malloc(size+1);
32
1.62k
    if (new_str == NULL) {
33
0
        return 0;
34
0
    }
35
1.62k
    memcpy(new_str, data, size);
36
1.62k
    new_str[size] = '\0';
37
38
1.62k
    pool *p = make_sub_pool(NULL);
39
1.62k
    if (p != NULL) {
40
1.62k
        init_json();        
41
1.62k
        pr_json_object_t *json = pr_json_object_from_text(p, new_str);
42
1.62k
        pr_json_object_free(json);
43
1.62k
        finish_json();
44
1.62k
        destroy_pool(p);
45
1.62k
    }
46
47
1.62k
    free(new_str);
48
1.62k
    return 0;
49
1.62k
}