/src/krb5/fuzzing/Fuzz_ndr.c
Line | Count | Source |
1 | | /* Copyright 2022 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 <stdio.h> |
13 | | #include <stdlib.h> |
14 | | #include <stdint.h> |
15 | | |
16 | | #include "k5-int.h" |
17 | | #include "kdc_util.h" |
18 | | |
19 | 7.78k | #define kMinInputLength 10 |
20 | 3.85k | #define kMaxInputLength 1024 |
21 | | |
22 | | extern int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) |
23 | 3.89k | {//src/kdc/t_ndr.c |
24 | | |
25 | 3.89k | if (Size < kMinInputLength || Size > kMaxInputLength){ |
26 | 150 | return 0; |
27 | 150 | } |
28 | | |
29 | 3.74k | krb5_data data_in; |
30 | 3.74k | krb5_error_code ret; |
31 | 3.74k | struct pac_s4u_delegation_info *di = NULL; |
32 | | |
33 | 3.74k | data_in = make_data((void *)Data, Size); |
34 | 3.74k | ret = ndr_dec_delegation_info(&data_in, &di); |
35 | 3.74k | ndr_free_delegation_info(di); |
36 | | |
37 | 3.74k | return ret; |
38 | 3.89k | } |