From: Victor Julien Date: Tue, 26 Apr 2022 18:05:51 +0000 (+0200) Subject: detect/analyzer: minor format string fixes X-Git-Tag: suricata-7.0.0-beta1~690 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a0847e6c697055b127343cc338029bc69bbc0791;p=thirdparty%2Fsuricata.git detect/analyzer: minor format string fixes cppcheck flagged this as: src/detect-engine-analyzer.c:1359:13: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint] fprintf(rule_engine_analysis_FD, " Rule contains %d content options, %d http content options, %d pcre options, and %d pcre options with http modifiers.\n", rule_content, rule_content_http, rule_pcre, rule_pcre_http); ^ src/detect-engine-analyzer.c:1359:13: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint] fprintf(rule_engine_analysis_FD, " Rule contains %d content options, %d http content options, %d pcre options, and %d pcre options with http modifiers.\n", rule_content, rule_content_http, rule_pcre, rule_pcre_http); ^ src/detect-engine-analyzer.c:1359:13: warning: %d in format string (no. 3) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint] fprintf(rule_engine_analysis_FD, " Rule contains %d content options, %d http content options, %d pcre options, and %d pcre options with http modifiers.\n", rule_content, rule_content_http, rule_pcre, rule_pcre_http); ^ src/detect-engine-analyzer.c:1359:13: warning: %d in format string (no. 4) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint] fprintf(rule_engine_analysis_FD, " Rule contains %d content options, %d http content options, %d pcre options, and %d pcre options with http modifiers.\n", rule_content, rule_content_http, rule_pcre, rule_pcre_http); ^ Bug: #5291. --- diff --git a/src/detect-engine-analyzer.c b/src/detect-engine-analyzer.c index c2ffdef0b3..5bfe46cd2f 100644 --- a/src/detect-engine-analyzer.c +++ b/src/detect-engine-analyzer.c @@ -1356,7 +1356,10 @@ void EngineAnalysisRules(const DetectEngineCtx *de_ctx, fprintf(rule_engine_analysis_FD, " App layer protocol is %s.\n", AppProtoToString(s->alproto)); } if (rule_content || rule_content_http || rule_pcre || rule_pcre_http) { - fprintf(rule_engine_analysis_FD, " Rule contains %d content options, %d http content options, %d pcre options, and %d pcre options with http modifiers.\n", rule_content, rule_content_http, rule_pcre, rule_pcre_http); + fprintf(rule_engine_analysis_FD, + " Rule contains %u content options, %u http content options, %u pcre " + "options, and %u pcre options with http modifiers.\n", + rule_content, rule_content_http, rule_pcre, rule_pcre_http); } /* print fast pattern info */