3 Copyright (C) Catalyst IT 2020
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 3 of the License, or
8 (at your option) any later version.
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.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "../../source3/include/includes.h"
20 #include "libsmb/libsmb.h"
21 #include "libsmb/nmblib.h"
22 #include "fuzzing/fuzzing.h"
25 #define MAX_LENGTH (1024 * 1024)
26 char buf
[MAX_LENGTH
+ 1];
29 int LLVMFuzzerTestOneInput(const uint8_t *input
, size_t len
)
31 struct packet_struct
*p
= NULL
;
33 0x0100007f /* 127.0.0.1 */
36 p
= parse_packet((char *)input
,
42 * We expect NULL (parse failure) most of the time.
44 * When it is not NULL we want to ensure the parsed packet is
49 struct nmb_packet
*nmb
= &p
->packet
.nmb
;
50 pull_ascii_nstring(buf
, MAX_LENGTH
,
51 nmb
->question
.question_name
.name
);
52 build_packet(buf
, MAX_LENGTH
, p
);
59 int LLVMFuzzerInitialize(int *argc
, char ***argv
)