main/options: Limit verbose option count

Issue: 7389

Continue to recognize multiple 'v' specifications up to the maximum
recognized. The maximum recognized is the number of slots between the
NOTICE and CONFIG levels.
pull/14267/head
Jeff Lucovsky 1 month ago
parent bb1ed16408
commit 009610281d

@ -168,6 +168,9 @@ SC_ATOMIC_DECLARE(unsigned int, engine_stage);
/* Max packets processed simultaneously per thread. */
#define DEFAULT_MAX_PENDING_PACKETS 1024
/* Maximum number of v's supported */
#define VERBOSE_MAX (SC_LOG_CONFIG - SC_LOG_NOTICE)
/** suricata engine control flags */
volatile uint8_t suricata_ctl_flags = 0;
@ -2084,9 +2087,15 @@ TmEcode SCParseCommandLine(int argc, char **argv)
SetBpfStringFromFile(optarg);
break;
case 'v':
suri->verbose++;
break;
case 'v': {
static bool ignore_extra = false;
if (suri->verbose < VERBOSE_MAX)
suri->verbose++;
else if (!ignore_extra) {
SCLogNotice("extraneous verbose option(s) ignored");
ignore_extra = true;
}
} break;
case 'k':
if (optarg == NULL) {
SCLogError("no option argument (optarg) for -k");
@ -3045,6 +3054,10 @@ void SuricataInit(void)
if (suricata.run_mode == RUNMODE_CONF_TEST)
SCLogInfo("Running suricata under test mode");
if (suricata.verbose) {
SCLogInfo("Running with verbose level %d", suricata.verbose);
}
if (ParseInterfacesList(suricata.aux_run_mode, suricata.pcap_dev) != TM_ECODE_OK) {
exit(EXIT_FAILURE);
}

Loading…
Cancel
Save