Coverage Report

Created: 2026-04-08 06:32

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/libfido2/src/buf.c
Line
Count
Source
1
/*
2
 * Copyright (c) 2018 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 "fido.h"
9
10
int
11
fido_buf_read(const unsigned char **buf, size_t *len, void *dst, size_t count)
12
251k
{
13
251k
        if (count > *len)
14
3.94k
                return (-1);
15
16
247k
        memcpy(dst, *buf, count);
17
247k
        *buf += count;
18
247k
        *len -= count;
19
20
247k
        return (0);
21
251k
}
22
23
int
24
fido_buf_write(unsigned char **buf, size_t *len, const void *src, size_t count)
25
15.9M
{
26
15.9M
        if (count > *len)
27
4.81k
                return (-1);
28
29
15.9M
        memcpy(*buf, src, count);
30
15.9M
        *buf += count;
31
15.9M
        *len -= count;
32
33
15.9M
        return (0);
34
15.9M
}