## Coverage Report

#### Created: 2025-03-01 02:43

next uncovered line (L), next uncovered region (R), next uncovered branch (B)

    /libfido2/src/util.c

    Line
    Count
    Source
    1
    /*
    2
     * Copyright (c) 2022 Yubico AB. All rights reserved.
    3
     * Use of this source code is governed by a BSD-style
    4
     * license that can be found in the LICENSE file.
    5
     * SPDX-License-Identifier: BSD-2-Clause
    6
     */
    7
    8
    #include <errno.h>
    9
    #include <stdint.h>
    10
    #include <stdlib.h>
    11
    12
    #include "fido.h"
    13
    14
    int
    15
    fido_to_uint64(const char *str, int base, uint64_t *out)
    16
    2.49M
    {
    17
    2.49M
            char *ep;
    18
    2.49M
            unsigned long long ull;
    19
    20
    2.49M
            errno = 0;
    21
    2.49M
            ull = strtoull(str, &ep, base);
    22
    2.49M
            if (str == ep || *ep != '\0')
    23
    273
                    return -1;
    24
    2.49M
            else if (ull == ULLONG_MAX && errno == ERANGE)
    25
    31
                    return -1;
    26
    2.49M
            else if (ull > UINT64_MAX)
    27
    0
                    return -1;
    28
    2.49M
            *out = (uint64_t)ull;
    29
    30
    2.49M
            return 0;
    31
    2.49M
    }