From: Victor Julien Date: Wed, 2 Oct 2019 13:01:29 +0000 (+0200) Subject: reference: use global defines for size limits X-Git-Tag: suricata-5.0.0~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d17a3b3c2bb0df907567a2f2a8365c8f5ffb1227;p=thirdparty%2Fsuricata.git reference: use global defines for size limits --- diff --git a/src/detect-reference.c b/src/detect-reference.c index cff04f7bcc..d7aabf629c 100644 --- a/src/detect-reference.c +++ b/src/detect-reference.c @@ -99,8 +99,8 @@ static DetectReference *DetectReferenceParse(const char *rawstr, DetectEngineCtx #define MAX_SUBSTRINGS 30 int ret = 0, res = 0; int ov[MAX_SUBSTRINGS]; - char key[64] = ""; - char content[1024] = ""; + char key[REFERENCE_SYSTEM_NAME_MAX] = ""; + char content[REFERENCE_CONTENT_NAME_MAX] = ""; ret = pcre_exec(parse_regex, parse_regex_study, rawstr, strlen(rawstr), 0, 0, ov, MAX_SUBSTRINGS); diff --git a/src/util-reference-config.c b/src/util-reference-config.c index 2cbfaf3c2f..fe57f6a64e 100644 --- a/src/util-reference-config.c +++ b/src/util-reference-config.c @@ -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 * 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) { - char system[64]; - char url[1024]; + char system[REFERENCE_SYSTEM_NAME_MAX]; + char url[REFERENCE_CONTENT_NAME_MAX]; SCRConfReference *ref_new = NULL; SCRConfReference *ref_lookup = NULL; diff --git a/src/util-reference-config.h b/src/util-reference-config.h index f7fe4cc1eb..fc7ea34e86 100644 --- a/src/util-reference-config.h +++ b/src/util-reference-config.h @@ -24,6 +24,9 @@ #ifndef __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. */