Coverage Report

Created: 2023-03-26 06:13

/src/krb5/fuzzing/Fuzz_chpw.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
#include <string.h>
16
17
#include "k5-int.h"
18
#include "krb5.h"
19
20
8.06k
#define kMinInputLength 20
21
3.99k
#define kMaxInputLength 100
22
23
extern int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) 
24
4.03k
{//src/tests/misc/test_chpw_message.c
25
26
4.03k
    if (Size < kMinInputLength || Size > kMaxInputLength){
27
156
        return 0;
28
156
    }
29
30
3.87k
    char *msg;
31
3.87k
    krb5_data DataInput;
32
3.87k
    krb5_context context;
33
34
3.87k
    krb5_init_context(&context);
35
36
3.87k
    DataInput = make_data((void *)Data, Size);
37
38
3.87k
    krb5_chpw_message(context, &DataInput, &msg);
39
40
3.87k
    free(msg);
41
3.87k
    krb5_free_context(context);
42
3.87k
    return 0;
43
4.03k
}