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 "librpc/gen_ndr/ndr_epmapper.h"
20 #include "librpc/rpc/dcerpc.h"
21 #include "fuzzing/fuzzing.h"
23 #define MAX_LENGTH (1024 * 10)
24 char buf[MAX_LENGTH + 1];
27 int LLVMFuzzerTestOneInput(uint8_t *input, size_t len)
29 TALLOC_CTX *mem_ctx = talloc_new(NULL);
30 struct dcerpc_binding *binding = NULL;
31 struct dcerpc_binding *dup = NULL;
32 struct epm_tower tower;
36 if (len > MAX_LENGTH) {
39 memcpy(buf, input, len);
42 status = dcerpc_parse_binding(mem_ctx, buf, &binding);
44 if (! NT_STATUS_IS_OK(status)) {
49 /* If the string parses, we try manipulating it a bit */
51 dcerpc_binding_string(mem_ctx, binding);
52 dcerpc_binding_get_abstract_syntax(binding);
53 dup = dcerpc_binding_dup(mem_ctx, binding);
55 status = dcerpc_binding_build_tower(mem_ctx,
58 if (NT_STATUS_IS_OK(status)) {
59 status = dcerpc_binding_from_tower(mem_ctx,
64 guid = dcerpc_binding_get_object(binding);