smbstatus: add frame files for json specific methods
[Samba.git] / lib / fuzzing / fuzz_reg_parse.c
bloba061cd6294ba9bd5466e46c1e6c0017674eee792
1 /*
2 * Fuzzing for reg_parse
3 * Copyright (C) Michael Hanselmann 2019
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 "includes.h"
20 #include "fuzzing/fuzzing.h"
21 #include "lib/util/fault.h"
22 #include "registry.h"
23 #include "registry/reg_parse.h"
25 static FILE *fp;
27 int LLVMFuzzerInitialize(int *argc, char ***argv)
29 fp = tmpfile();
31 return 0;
34 int LLVMFuzzerTestOneInput(uint8_t *buf, size_t len)
36 const reg_parse_callback cb = {0};
38 rewind(fp);
39 (void)fwrite(buf, len, 1, fp);
40 (void)fflush(fp);
41 rewind(fp);
43 (void)reg_parse_fd(fileno(fp), &cb, "");
45 return 0;