Coverage Report

Created: 2026-01-16 07:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/suricata7/src/detect-byte.c
Line
Count
Source
1
/* Copyright (C) 2020 Open Information Security Foundation
2
 *
3
 * You can copy, redistribute or modify this Program under the terms of
4
 * the GNU General Public License version 2 as published by the Free
5
 * Software Foundation.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * version 2 along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15
 * 02110-1301, USA.
16
 */
17
18
/**
19
 * \file
20
 *
21
 * \author Jeff Lucovsky <jeff@lucovsky.org>
22
 */
23
24
#include "suricata-common.h"
25
#include "detect-byte.h"
26
#include "detect-byte-extract.h"
27
#include "detect-bytemath.h"
28
#include "rust.h"
29
/**
30
 * \brief Used to retrieve args from BM.
31
 *
32
 * \param arg The name of the variable being sought
33
 * \param s The signature to check for the variable
34
 * \param index When found, the value of the slot within the byte vars
35
 *
36
 * \retval true A match for the variable was found.
37
 * \retval false
38
 */
39
bool DetectByteRetrieveSMVar(const char *arg, const Signature *s, DetectByteIndexType *index)
40
73.6k
{
41
73.6k
    SigMatch *bed_sm = DetectByteExtractRetrieveSMVar(arg, s);
42
73.6k
    if (bed_sm != NULL) {
43
48.5k
        *index = ((DetectByteExtractData *)bed_sm->ctx)->local_id;
44
48.5k
        return true;
45
48.5k
    }
46
47
25.0k
    SigMatch *bmd_sm = DetectByteMathRetrieveSMVar(arg, s);
48
25.0k
    if (bmd_sm != NULL) {
49
7.17k
        *index = ((DetectByteMathData *)bmd_sm->ctx)->local_id;
50
7.17k
        return true;
51
7.17k
    }
52
17.8k
    return false;
53
25.0k
}