Line | Count | Source |
1 | | /* Copyright 2021 Google LLC |
2 | | Licensed under the Apache License, Version 2.0 (the "License"); |
3 | | you may not use this file except in compliance with the License. |
4 | | You may obtain a copy of the License at |
5 | | http://www.apache.org/licenses/LICENSE-2.0 |
6 | | Unless required by applicable law or agreed to in writing, software |
7 | | distributed under the License is distributed on an "AS IS" BASIS, |
8 | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
9 | | See the License for the specific language governing permissions and |
10 | | limitations under the License. |
11 | | */ |
12 | | |
13 | | #include "config.h" |
14 | | #include "syshead.h" |
15 | | #include "dhcp.h" |
16 | | #include "buffer.h" |
17 | | |
18 | | #include "fuzz_randomizer.h" |
19 | | |
20 | 271 | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { |
21 | 271 | struct buffer ipbuf; |
22 | 271 | in_addr_t ret; |
23 | | |
24 | 271 | fuzz_random_init(data, size); |
25 | 271 | char *ran_val = get_random_string(); |
26 | | |
27 | 271 | ipbuf = alloc_buf(strlen(ran_val)); |
28 | 271 | if (buf_write(&ipbuf, ran_val, strlen(ran_val)) != false) { |
29 | 271 | ret = dhcp_extract_router_msg(&ipbuf); |
30 | 271 | } |
31 | 271 | free_buf(&ipbuf); |
32 | | |
33 | 271 | fuzz_random_destroy(); |
34 | 271 | free(ran_val); |
35 | | |
36 | 271 | return 0; |
37 | 271 | } |