Fixed findings

List of Findings

Error: COMPILER_WARNING: [#def1]
tomcat-native-1.3.0-src/native/os/unix/system.c: scope_hint: In function 'Java_org_apache_tomcat_jni_OS_syslog'
tomcat-native-1.3.0-src/native/os/unix/system.c:437:18: warning[-Wformat-overflow=]: '%s' directive argument is null
#  437 |     syslog (id, "%s", J2S(msg));
#      |                  ^~
#  435|           break;
#  436|       }
#  437|->     syslog (id, "%s", J2S(msg));
#  438|   
#  439|       TCN_FREE_CSTRING(msg);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def2]
tomcat-native-1.3.0-src/native/src/network.c:434:5: warning[-Wanalyzer-null-argument]: use of NULL 'p' where non-null expected
tomcat-native-1.3.0-src/native/src/network.c:401:19: release_memory: 'p' is NULL
tomcat-native-1.3.0-src/native/src/network.c:408:5: branch_true: following 'true' branch...
tomcat-native-1.3.0-src/native/src/network.c:408:5: branch_true: ...to here
tomcat-native-1.3.0-src/native/src/network.c:408:5: release_memory: 'p' is NULL
tomcat-native-1.3.0-src/native/src/network.c:434:5: release_memory: 'p' is NULL
tomcat-native-1.3.0-src/native/src/network.c:434:5: danger: argument 1 ('p') NULL where non-null expected
#  432|   cleanup:
#  433|       TCN_ASSERT(p != 0);
#  434|->     apr_pool_destroy(p);
#  435|       return 0;
#  436|   }

Error: GCC_ANALYZER_WARNING (CWE-688): [#def3]
tomcat-native-1.3.0-src/native/src/pool.c:208:9: warning[-Wanalyzer-null-argument]: use of NULL 'ckey' where non-null expected
tomcat-native-1.3.0-src/native/src/pool.c:202:5: branch_false: following 'false' branch (when 'key' is NULL)...
tomcat-native-1.3.0-src/native/src/pool.c:208:9: branch_false: ...to here
tomcat-native-1.3.0-src/native/src/pool.c:208:9: danger: argument 2 ('ckey') NULL where non-null expected
#  206|       TCN_ASSERT(key != 0);
#  207|   
#  208|->     if (apr_pool_userdata_get(&old, J2S(key), p) == APR_SUCCESS) {
#  209|           if (old)
#  210|               apr_pool_cleanup_run(p, old, generic_pool_data_cleanup);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
tomcat-native-1.3.0-src/native/src/pool.c:216:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cb'
tomcat-native-1.3.0-src/native/src/pool.c:202:5: branch_true: following 'true' branch (when 'key' is non-NULL)...
tomcat-native-1.3.0-src/native/src/pool.c:202:5: branch_true: ...to here
tomcat-native-1.3.0-src/native/src/pool.c:212:8: branch_true: following 'true' branch (when 'data' is non-NULL)...
tomcat-native-1.3.0-src/native/src/pool.c:214:48: branch_true: ...to here
tomcat-native-1.3.0-src/native/src/pool.c:214:48: acquire_memory: this call could return NULL
tomcat-native-1.3.0-src/native/src/pool.c:216:9: danger: 'cb' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
#  214|           tcn_callback_t *cb = (tcn_callback_t *)malloc(sizeof(tcn_callback_t));
#  215|           tcn_get_java_env(&e);
#  216|->         cb->obj = (*e)->NewGlobalRef(e, data);
#  217|           if ((rv = apr_pool_userdata_set(cb, J2S(key), generic_pool_data_cleanup,
#  218|                                           p)) != APR_SUCCESS) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
tomcat-native-1.3.0-src/native/src/pool.c:228:12: warning[-Wanalyzer-malloc-leak]: leak of 'cb'
tomcat-native-1.3.0-src/native/src/pool.c:202:5: branch_true: following 'true' branch (when 'key' is non-NULL)...
tomcat-native-1.3.0-src/native/src/pool.c:202:5: branch_true: ...to here
tomcat-native-1.3.0-src/native/src/pool.c:212:8: branch_true: following 'true' branch (when 'data' is non-NULL)...
tomcat-native-1.3.0-src/native/src/pool.c:214:48: branch_true: ...to here
tomcat-native-1.3.0-src/native/src/pool.c:214:48: acquire_memory: allocated here
tomcat-native-1.3.0-src/native/src/pool.c:217:12: branch_false: following 'false' branch...
 branch_false: ...to here
tomcat-native-1.3.0-src/native/src/pool.c:228:12: danger: 'cb' leaks here; was allocated at [(5)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/4)
#  226|       }
#  227|       TCN_FREE_CSTRING(key);
#  228|->     return rv;
#  229|   }
#  230|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def6]
tomcat-native-1.3.0-src/native/src/pool.c:243:9: warning[-Wanalyzer-null-argument]: use of NULL 'ckey' where non-null expected
tomcat-native-1.3.0-src/native/src/pool.c:236:5: branch_false: following 'false' branch (when 'key' is NULL)...
tomcat-native-1.3.0-src/native/src/pool.c:243:9: branch_false: ...to here
tomcat-native-1.3.0-src/native/src/pool.c:243:9: danger: argument 2 ('ckey') NULL where non-null expected
#  241|       TCN_ASSERT(key != 0);
#  242|   
#  243|->     if (apr_pool_userdata_get(&old, J2S(key), p) == APR_SUCCESS) {
#  244|           if (old) {
#  245|               tcn_callback_t *cb = (tcn_callback_t *)old;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
tomcat-native-1.3.0-src/native/src/proc.c:388:5: warning[-Wanalyzer-malloc-leak]: leak of 'cb'
tomcat-native-1.3.0-src/native/src/proc.c:375:44: acquire_memory: allocated here
tomcat-native-1.3.0-src/native/src/proc.c:380:8: branch_false: following 'false' branch (when 'cb' is non-NULL)...
tomcat-native-1.3.0-src/native/src/proc.c:383:11: branch_false: ...to here
tomcat-native-1.3.0-src/native/src/proc.c:388:5: danger: 'cb' leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  386|   
#  387|       apr_pool_userdata_setn(cb, ERRFN_USERDATA_KEY, child_errfn_pool_cleanup, p);
#  388|->     apr_procattr_child_errfn_set(a, generic_child_errfn);
#  389|   
#  390|   }

Scan Properties

analyzer-version-clippy1.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.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.0.1
diffbase-analyzer-version-gcc-analyzer15.0.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-230.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.20250425.124705.g1c7c448.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-nametomcat-native-2.0.8-1.fc43
diffbase-store-results-to/tmp/tmpdatuowo3/tomcat-native-2.0.8-1.fc43.tar.xz
diffbase-time-created2025-04-25 15:48:56
diffbase-time-finished2025-04-25 15:50:09
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmpdatuowo3/tomcat-native-2.0.8-1.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpdatuowo3/tomcat-native-2.0.8-1.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-230.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-nametomcat-native-1.3.0-9.fc42
store-results-to/tmp/tmpr2lp97bb/tomcat-native-1.3.0-9.fc42.tar.xz
time-created2025-04-25 15:46:55
time-finished2025-04-25 15:48:32
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmpr2lp97bb/tomcat-native-1.3.0-9.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpr2lp97bb/tomcat-native-1.3.0-9.fc42.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9