Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-688): [#def1]
libssh-0.10.6-build/libssh-0.10.6/examples/libssh_scp.c: scope_hint: In function ‘open_location’
libssh-0.10.6-build/libssh-0.10.6/examples/libssh_scp.c:236:42: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*loc.path’ where non-null expected
libssh-0.10.6-build/libssh-0.10.6/examples/libssh_scp.c:19: included_from: Included from here.
libssh-0.10.6-build/libssh-0.10.6/include/libssh/libssh.h:63: included_from: Included from here.
/usr/include/unistd.h:517:12: note: argument 1 of ‘chdir’ must be non-null
#  234|           if (!loc->file) {
#  235|               if (errno == EISDIR) {
#  236|->                 if (loc->path != NULL && chdir(loc->path)) {
#  237|                       fprintf(stderr,
#  238|                               "Error changing directory to %s: %s\n",

Error: GCC_ANALYZER_WARNING (CWE-476): [#def2]
libssh-0.10.6-build/libssh-0.10.6/examples/ssh_X11_client.c: scope_hint: In function ‘insert_item’
libssh-0.10.6-build/libssh-0.10.6/examples/ssh_X11_client.c:279:31: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘node’
#  277|   		/* Calloc ensure that node is full of 0 */
#  278|   		node = (node_t *) calloc(1, sizeof(node_t));
#  279|-> 		node->channel = channel;
#  280|   		node->fd_in = fd_in;
#  281|   		node->fd_out = fd_out;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def3]
libssh-0.10.6-build/libssh-0.10.6/examples/ssh_X11_client.c:290:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘new’
#  288|   		/* Create the new node */
#  289|   		new = (node_t *) malloc(sizeof(node_t));
#  290|-> 		new->channel = channel;
#  291|   		new->fd_in = fd_in;
#  292|   		new->fd_out = fd_out;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
libssh-0.10.6-build/libssh-0.10.6/examples/sshd_direct-tcpip.c: scope_hint: In function ‘cleanup_push’
libssh-0.10.6-build/libssh-0.10.6/examples/sshd_direct-tcpip.c:99:24: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘new_node’
#   97|   
#   98|       if (*head_ref != NULL) {
#   99|->         new_node->next = *head_ref;
#  100|       } else {
#  101|           new_node->next = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
libssh-0.10.6-build/libssh-0.10.6/examples/sshd_direct-tcpip.c:101:24: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘new_node’
#   99|           new_node->next = *head_ref;
#  100|       } else {
#  101|->         new_node->next = NULL;
#  102|       }
#  103|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def6]
libssh-0.10.6-build/libssh-0.10.6/src/bind.c: scope_hint: In function ‘ssh_bind_accept_fd’
libssh-0.10.6-build/libssh-0.10.6/src/bind.c:442:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘*sshbind.bindfd’
#  440|   
#  441|       /* Apply global bind configurations, if it hasn't been applied before */
#  442|->     rc = ssh_bind_options_parse_config(sshbind, NULL);
#  443|       if (rc != 0) {
#  444|           ssh_set_error(sshbind, SSH_FATAL,"Could not parse global config");

Error: GCC_ANALYZER_WARNING (CWE-688): [#def7]
libssh-0.10.6-build/libssh-0.10.6/src/ecdh_crypto.c: scope_hint: In function ‘ecdh_build_k’
libssh-0.10.6-build/libssh-0.10.6/src/ecdh_crypto.c:302:15: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
libssh-0.10.6-build/libssh-0.10.6/src/ecdh_crypto.c: scope_hint: In function ‘ecdh_build_k’
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
#  300|                                                   ssh_string_len(peer_pubkey));
#  301|     curve = ecdh_kex_type_to_curve(next_crypto->kex_type);
#  302|->   params[1] = OSSL_PARAM_construct_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME,
#  303|                                                  (char *)curve,
#  304|                                                  strlen(curve));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
libssh-0.10.6-build/libssh-0.10.6/src/gssapi.c: scope_hint: In function ‘ssh_packet_userauth_gssapi_token_server’
libssh-0.10.6-build/libssh-0.10.6/src/gssapi.c:180:16: warning[-Wanalyzer-malloc-leak]: leak of ‘ssh_gssapi_name_to_char(client_name)’
libssh-0.10.6-build/libssh-0.10.6/include/libssh/priv.h:174: included_from: Included from here.
libssh-0.10.6-build/libssh-0.10.6/include/libssh/session.h:25: included_from: Included from here.
libssh-0.10.6-build/libssh-0.10.6/include/libssh/gssapi.h:25: included_from: Included from here.
libssh-0.10.6-build/libssh-0.10.6/src/gssapi.c:32: included_from: Included from here.
libssh-0.10.6-build/libssh-0.10.6/include/libssh/callbacks.h:533:13: note: in definition of macro ‘SSH_PACKET_CALLBACK’
libssh-0.10.6-build/libssh-0.10.6/include/libssh/callbacks.h:439:4: note: in definition of macro ‘ssh_callbacks_exists’
#  178|           gss_release_buffer(&dummy_min, &msg_maj);
#  179|       }
#  180|->     if (msg_min.value) {
#  181|           gss_release_buffer(&dummy_min, &msg_min);
#  182|       }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def9]
libssh-0.10.6-build/libssh-0.10.6/tests/client/torture_sftp_read.c:6: included_from: Included from here.
libssh-0.10.6-build/libssh-0.10.6/src/sftp.c: scope_hint: In function ‘sftp_read’
libssh-0.10.6-build/libssh-0.10.6/src/sftp.c:1920:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘handle’
# 1918|   /* Read from a file using an opened sftp file handle. */
# 1919|   ssize_t sftp_read(sftp_file handle, void *buf, size_t count) {
# 1920|->   sftp_session sftp = handle->sftp;
# 1921|     sftp_message msg = NULL;
# 1922|     sftp_status_message status;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def10]
libssh-0.10.6-build/libssh-0.10.6/tests/client/torture_sftp_fsync.c:6: included_from: Included from here.
libssh-0.10.6-build/libssh-0.10.6/src/sftp.c: scope_hint: In function ‘sftp_write’
libssh-0.10.6-build/libssh-0.10.6/src/sftp.c:2150:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘file’
# 2148|   
# 2149|   ssize_t sftp_write(sftp_file file, const void *buf, size_t count) {
# 2150|->   sftp_session sftp = file->sftp;
# 2151|     sftp_message msg = NULL;
# 2152|     sftp_status_message status;

Error: COMPILER_WARNING (CWE-563): [#def11]
libssh-0.10.6-build/libssh-0.10.6/tests/torture.c: scope_hint: In function ‘torture_setup_tokens’
libssh-0.10.6-build/libssh-0.10.6/tests/torture.c:1242:10: warning[-Wunused-variable]: unused variable ‘conf_path’
# 1242 |     char conf_path[1024] = {0};
#      |          ^~~~~~~~~
# 1240|       char token_setup_start_cmd[1024] = {0};
# 1241|       char socket_path[1204] = {0};
# 1242|->     char conf_path[1024] = {0};
# 1243|       int rc;
# 1244|   

Error: COMPILER_WARNING (CWE-563): [#def12]
libssh-0.10.6-build/libssh-0.10.6/tests/torture.c:1286:9: warning[-Wunused-variable]: unused variable ‘rc’
# 1286 |     int rc;
#      |         ^~
# 1284|   {
# 1285|       char pidfile[1024] = {0};
# 1286|->     int rc;
# 1287|       pid_t pid;
# 1288|   

Error: COMPILER_WARNING (CWE-563): [#def13]
libssh-0.10.6-build/libssh-0.10.6/tests/torture.c: scope_hint: In function ‘torture_cleanup_tokens’
libssh-0.10.6-build/libssh-0.10.6/tests/torture.c:1287:11: warning[-Wunused-variable]: unused variable ‘pid’
# 1287 |     pid_t pid;
#      |           ^~~
# 1285|       char pidfile[1024] = {0};
# 1286|       int rc;
# 1287|->     pid_t pid;
# 1288|   
# 1289|   #ifdef WITH_PKCS11_PROVIDER

Error: GCC_ANALYZER_WARNING (CWE-688): [#def14]
libssh-0.10.6-build/libssh-0.10.6/tests/torture.h:37: included_from: Included from here.
libssh-0.10.6-build/libssh-0.10.6/tests/unittests/torture_pki_ecdsa.c:9: included_from: Included from here.
libssh-0.10.6-build/libssh-0.10.6/tests/unittests/torture_pki_ecdsa.c: scope_hint: In function ‘torture_pki_ecdsa_name’
libssh-0.10.6-build/libssh-0.10.6/tests/unittests/torture_pki_ecdsa.c:920:17: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
libssh-0.10.6-build/libssh-0.10.6/tests/unittests/torture_pki_ecdsa.c:8: included_from: Included from here.
libssh-0.10.6-build/libssh-0.10.6/tests/unittests/torture_pki_ecdsa.c: scope_hint: In function ‘torture_pki_ecdsa_name’
/usr/include/openssl/ec.h:23: included_from: Included from here.
libssh-0.10.6-build/libssh-0.10.6/include/libssh/libcrypto.h:36: included_from: Included from here.
libssh-0.10.6-build/libssh-0.10.6/include/libssh/wrapper.h:28: included_from: Included from here.
libssh-0.10.6-build/libssh-0.10.6/src/pki.c:36: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
#  918|   
#  919|       etype_char =ssh_pki_key_ecdsa_name(key);
#  920|->     assert_true(strcmp(etype_char, expected_name) == 0);
#  921|   
#  922|       SSH_KEY_FREE(key);

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.82.0
diffbase-analyzer-version-cppcheck2.16.0
diffbase-analyzer-version-gcc14.2.1
diffbase-analyzer-version-gcc-analyzer15.0.0
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-86.us-west-2.compute.internal
diffbase-mock-configfedora-rawhide-gcc-latest-x86_64
diffbase-project-namelibssh-0.11.1-1.fc42
diffbase-store-results-to/tmp/tmpxoq8qzff/libssh-0.11.1-1.fc42.tar.xz
diffbase-time-created2024-11-13 01:48:01
diffbase-time-finished2024-11-13 01:55:05
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpxoq8qzff/libssh-0.11.1-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpxoq8qzff/libssh-0.11.1-1.fc42.src.rpm'
diffbase-tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-86.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namelibssh-0.10.6-8.fc41
store-results-to/tmp/tmpfu2djo8y/libssh-0.10.6-8.fc41.tar.xz
time-created2024-11-13 01:40:28
time-finished2024-11-13 01:47:48
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpfu2djo8y/libssh-0.10.6-8.fc41.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpfu2djo8y/libssh-0.10.6-8.fc41.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9