Skip to content

Commit

Permalink
src: fix coverity warning about sizeof
Browse files Browse the repository at this point in the history
CID: 1520601
CID: 1520602

> In this particular case sizeof (char **) happens to be equal to
sizeof (char *), but this is not a portable assumption.
  • Loading branch information
catenacyber authored and victorjulien committed Jan 28, 2023
1 parent 84d1ed5 commit c1f615b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/suricata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
}
} else if (strcmp((long_opts[option_index]).name, "include") == 0) {
if (suri->additional_configs == NULL) {
suri->additional_configs = SCCalloc(2, sizeof(char **));
suri->additional_configs = SCCalloc(2, sizeof(char *));
if (suri->additional_configs == NULL) {
FatalError(
"Failed to allocate memory for additional configuration files: %s",
Expand All @@ -1783,7 +1783,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
for (int i = 0;; i++) {
if (suri->additional_configs[i] == NULL) {
const char **additional_configs =
SCRealloc(suri->additional_configs, (i + 2) * sizeof(char **));
SCRealloc(suri->additional_configs, (i + 2) * sizeof(char *));
if (additional_configs == NULL) {
FatalError("Failed to allocate memory for additional configuration "
"files: %s",
Expand Down

0 comments on commit c1f615b

Please sign in to comment.