2 Fuzzing parse_lpq_entry
3 Copyright (C) Douglas Bagnall <dbagnall@samba.org> 2021
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/>.
18 #include "../../source3/include/includes.h"
20 #include "fuzzing/fuzzing.h"
23 int LLVMFuzzerInitialize(int *argc
, char ***argv
)
28 #define MAX_LENGTH (1024 * 1024)
29 char line
[MAX_LENGTH
+ 1];
31 int LLVMFuzzerTestOneInput(const uint8_t *input
, size_t len
)
33 enum printing_types printing_type
;
34 print_queue_struct pq_buf
= {0};
35 print_status_struct status
= {0};
38 TALLOC_CTX
*frame
= NULL
;
40 if (len
< 1 || len
> MAX_LENGTH
) {
48 /* There are 14 types, default goes to bsd */
49 printing_type
= x
& 15;
50 first
= (x
& 16) ? true : false;
52 memcpy(line
, input
, len
);
55 /* parse_lpq_bsd requires a stackframe */
56 frame
= talloc_stackframe();
58 parse_lpq_entry(printing_type
,