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 | | #include <config.h> |
13 | | |
14 | | #include <stdint.h> |
15 | | #include <string.h> |
16 | | #include <stdlib.h> |
17 | | #include <syslog.h> |
18 | | |
19 | | #include "bluetooth.h" |
20 | | #include "sdp.h" |
21 | | #include "sdp_lib.h" |
22 | | |
23 | 74 | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { |
24 | | |
25 | | /* Target sdp_extract_pdu */ |
26 | 74 | int scanned = 0; |
27 | 74 | sdp_record_t *out = NULL; |
28 | 74 | openlog("fuzz_sdp", LOG_PERROR, LOG_LOCAL0); |
29 | 74 | out = sdp_extract_pdu(data, size, &scanned); |
30 | 74 | if (out) { |
31 | 74 | sdp_record_t *copy = sdp_copy_record(out); |
32 | 74 | if (copy) { |
33 | 74 | sdp_record_free(copy); |
34 | 74 | } |
35 | 74 | sdp_record_free(out); |
36 | 74 | } |
37 | 74 | closelog(); |
38 | | |
39 | 74 | return 0; |
40 | 74 | } |