Coverage Report

Created: 2026-02-09 06:32

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/auth_fuzzer.c
Line
Count
Source
1
// Copyright 2025 Google LLC
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
//
15
////////////////////////////////////////////////////////////////////////////////
16
17
#include <stdint.h>
18
#include <stdlib.h>
19
#include <string.h>
20
#include <openssl/bio.h>
21
#include <openssl/evp.h>
22
23
// Declaration of the function from iperf_auth.c (it is not static)
24
int Base64Decode(const char* b64message, unsigned char** buffer, size_t* length);
25
26
1.49k
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
27
    // Base64Decode expects a null-terminated string.
28
1.49k
    char *str = (char *)malloc(size + 1);
29
1.49k
    if (!str) {
30
0
        return 0;
31
0
    }
32
1.49k
    memcpy(str, data, size);
33
1.49k
    str[size] = '\0';
34
35
1.49k
    unsigned char *buffer = NULL;
36
1.49k
    size_t length = 0;
37
38
    // Call the target function
39
1.49k
    Base64Decode(str, &buffer, &length);
40
41
1.49k
    if (buffer) {
42
505
        free(buffer);
43
505
    }
44
1.49k
    free(str);
45
1.49k
    return 0;
46
1.49k
}