Project

General

Profile

Bug #2870

pcap logging with lz4 coverity warning

Added by Victor Julien 15 days ago. Updated 13 days ago.

Status:
Assigned
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

This next one is in the #ifdef HAVE_LIBLZ4 code. It seems to forget about
calling:

        SCFree(copy->h);
        SCFree(copy);

on the error paths.

Error: RESOURCE_LEAK (CWE-772):
suricata-4.1.3/src/log-pcap.c:606: alloc_fn: Storage is returned from allocation function "calloc".
suricata-4.1.3/src/log-pcap.c:606: var_assign: Assigning: "ptrmem" = storage returned from "calloc(1UL, 4608UL)".
suricata-4.1.3/src/log-pcap.c:606: leaked_storage: Variable "ptrmem" going out of scope leaks the storage it points to.
suricata-4.1.3/src/log-pcap.c:606: var_assign: Assigning: "copy" = "({...; (void *)ptrmem;})".
suricata-4.1.3/src/log-pcap.c:636: var_assign: Assigning: "copy_comp" = "copy".
suricata-4.1.3/src/log-pcap.c:653: leaked_storage: Variable "copy_comp" going out of scope leaks the storage it points to.
suricata-4.1.3/src/log-pcap.c:653: leaked_storage: Variable "copy" going out of scope leaks the storage it points to.
#  651|               SCLogError(SC_ERR_MEM_ALLOC, "SCMalloc failed: %s",
#  652|                       strerror(errno));
#  653|->             return NULL;
#  654|           }
#  655|           copy_comp->pcap_buf = SCMalloc(copy_comp->pcap_buf_siz

History

#1

Updated by Victor Julien 13 days ago

  • Status changed from New to Assigned
  • Assignee set to Max Fillinger
  • Target version set to 4.1.4

Also available in: Atom PDF