Fixed findings

List of Findings

Error: CPPCHECK_WARNING (CWE-562): [#def1]
libnice-0.1.22/agent/agent.c:4587: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 4585|     if (message->from == NULL) {
# 4586|       nice_address_init (&from);
# 4587|->     message->from = &from;
# 4588|     }
# 4589|   

Error: CPPCHECK_WARNING (CWE-476): [#def2]
libnice-0.1.22/stun/debug.c:100: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bytes
#   98|   
#   99|     bytes = malloc (prefix_len + 2 + (len * 2) + 1);
#  100|->   bytes[0] = 0;
#  101|     strcpy (bytes, prefix);
#  102|     strcpy (bytes + prefix_len, "0x");

Error: GCC_ANALYZER_WARNING (CWE-476): [#def3]
libnice-0.1.22/stun/debug.c: scope_hint: In function ‘stun_debug_bytes’
libnice-0.1.22/stun/debug.c:100:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘bytes’
#   98|   
#   99|     bytes = malloc (prefix_len + 2 + (len * 2) + 1);
#  100|->   bytes[0] = 0;
#  101|     strcpy (bytes, prefix);
#  102|     strcpy (bytes + prefix_len, "0x");

Error: CPPCHECK_WARNING (CWE-476): [#def4]
libnice-0.1.22/stun/debug.c:101: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bytes
#   99|     bytes = malloc (prefix_len + 2 + (len * 2) + 1);
#  100|     bytes[0] = 0;
#  101|->   strcpy (bytes, prefix);
#  102|     strcpy (bytes + prefix_len, "0x");
#  103|   

Error: CPPCHECK_WARNING (CWE-682): [#def5]
libnice-0.1.22/stun/debug.c:102: error[nullPointerArithmeticOutOfMemory]: If memory allocation fail: pointer addition with NULL pointer.
#  100|     bytes[0] = 0;
#  101|     strcpy (bytes, prefix);
#  102|->   strcpy (bytes + prefix_len, "0x");
#  103|   
#  104|     j = bytes + prefix_len + 2;

Error: CPPCHECK_WARNING (CWE-682): [#def6]
libnice-0.1.22/stun/debug.c:104: error[nullPointerArithmeticOutOfMemory]: If memory allocation fail: pointer addition with NULL pointer.
#  102|     strcpy (bytes + prefix_len, "0x");
#  103|   
#  104|->   j = bytes + prefix_len + 2;
#  105|     for (i = 0; i < len; i++) {
#  106|       k = ((const unsigned char *)data)[i];

Error: GCC_ANALYZER_WARNING (CWE-479): [#def7]
libnice-0.1.22/stun/tools/stund.c: scope_hint: In function ‘exit_handler’
libnice-0.1.22/stun/tools/stund.c:282:3: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘exit’ from within signal handler
libnice-0.1.22/stun/tools/stund.c:282:3: note: ‘_exit’ is a possible signal-safe alternative for ‘exit’
#  280|   {
#  281|     (void)signum;
#  282|->   exit (0);
#  283|   }
#  284|   

Error: CPPCHECK_WARNING (CWE-476): [#def8]
libnice-0.1.22/stun/usages/bind.c:236: warning[nullPointer]: Possible null pointer dereference: srv
#  234|   
#  235|     tr->dstlen = srvlen;
#  236|->   memcpy (&tr->dst, srv, srvlen);
#  237|   
#  238|     return STUN_USAGE_TRANS_RETURN_SUCCESS;

Error: CPPCHECK_WARNING (CWE-476): [#def9]
libnice-0.1.22/stun/usages/ice.c:116: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
#  114|       assert (attribute_len >= identifier_len);
#  115|       buf = malloc(attribute_len);
#  116|->     memset(buf, 0, attribute_len);
#  117|       memcpy(buf, candidate_identifier, identifier_len);
#  118|   

Error: CPPCHECK_WARNING (CWE-476): [#def10]
libnice-0.1.22/stun/usages/ice.c:117: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
#  115|       buf = malloc(attribute_len);
#  116|       memset(buf, 0, attribute_len);
#  117|->     memcpy(buf, candidate_identifier, identifier_len);
#  118|   
#  119|       val = stun_message_append_bytes (msg, STUN_ATTRIBUTE_CANDIDATE_IDENTIFIER,

Scan Properties

analyzer-version-clippy1.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.1.1
analyzer-version-gcc-analyzer15.1.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.86.0
diffbase-analyzer-version-cppcheck2.17.1
diffbase-analyzer-version-gcc15.1.1
diffbase-analyzer-version-gcc-analyzer15.1.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-67.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20250502.162211.gca63d41.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namelibnice-0.1.22-7.fc43
diffbase-store-results-to/tmp/tmpns5t949s/libnice-0.1.22-7.fc43.tar.xz
diffbase-time-created2025-05-02 14:47:15
diffbase-time-finished2025-05-02 14:49:48
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,shellcheck,unicontrol,clippy,cppcheck' '-o' '/tmp/tmpns5t949s/libnice-0.1.22-7.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmpns5t949s/libnice-0.1.22-7.fc43.src.rpm'
diffbase-tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-67.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250502.162211.gca63d41.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namelibnice-0.1.22-6.fc43
store-results-to/tmp/tmp3n5aryyg/libnice-0.1.22-6.fc43.tar.xz
time-created2025-05-02 14:43:50
time-finished2025-05-02 14:46:48
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,shellcheck,unicontrol,clippy,cppcheck' '-o' '/tmp/tmp3n5aryyg/libnice-0.1.22-6.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmp3n5aryyg/libnice-0.1.22-6.fc43.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9