reference: use global defines for size limits

pull/4288/head
Victor Julien 7 years ago
parent e278953455
commit d17a3b3c2b

@ -99,8 +99,8 @@ static DetectReference *DetectReferenceParse(const char *rawstr, DetectEngineCtx
#define MAX_SUBSTRINGS 30 #define MAX_SUBSTRINGS 30
int ret = 0, res = 0; int ret = 0, res = 0;
int ov[MAX_SUBSTRINGS]; int ov[MAX_SUBSTRINGS];
char key[64] = ""; char key[REFERENCE_SYSTEM_NAME_MAX] = "";
char content[1024] = ""; char content[REFERENCE_CONTENT_NAME_MAX] = "";
ret = pcre_exec(parse_regex, parse_regex_study, rawstr, strlen(rawstr), ret = pcre_exec(parse_regex, parse_regex_study, rawstr, strlen(rawstr),
0, 0, ov, MAX_SUBSTRINGS); 0, 0, ov, MAX_SUBSTRINGS);

@ -1,4 +1,4 @@
/* Copyright (C) 2007-2010 Open Information Security Foundation /* Copyright (C) 2007-2019 Open Information Security Foundation
* *
* You can copy, redistribute or modify this Program under the terms of * You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free * the GNU General Public License version 2 as published by the Free
@ -244,8 +244,8 @@ static char *SCRConfStringToLowercase(const char *str)
*/ */
static int SCRConfAddReference(char *rawstr, DetectEngineCtx *de_ctx) static int SCRConfAddReference(char *rawstr, DetectEngineCtx *de_ctx)
{ {
char system[64]; char system[REFERENCE_SYSTEM_NAME_MAX];
char url[1024]; char url[REFERENCE_CONTENT_NAME_MAX];
SCRConfReference *ref_new = NULL; SCRConfReference *ref_new = NULL;
SCRConfReference *ref_lookup = NULL; SCRConfReference *ref_lookup = NULL;

@ -24,6 +24,9 @@
#ifndef __UTIL_REFERENCE_CONFIG_H__ #ifndef __UTIL_REFERENCE_CONFIG_H__
#define __UTIL_REFERENCE_CONFIG_H__ #define __UTIL_REFERENCE_CONFIG_H__
#define REFERENCE_SYSTEM_NAME_MAX 64
#define REFERENCE_CONTENT_NAME_MAX 1024
/** /**
* \brief Holds a reference from the file - reference.config. * \brief Holds a reference from the file - reference.config.
*/ */

Loading…
Cancel
Save