cockpit-321-1.fc41

List of Defects

Error: GCC_ANALYZER_WARNING (CWE-775): [#def1]
cockpit-321-build/cockpit-321/src/bridge/cockpitpeer.c: scope_hint: In function ‘spawn_setup’
cockpit-321-build/cockpit-321/src/bridge/cockpitpeer.c:858:6: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd, 0)’
#  856|     prctl (PR_SET_PDEATHSIG, SIGHUP);
#  857|   
#  858|->   if (dup2 (fd, 0) < 0 || dup2 (fd, 1) < 0)
#  859|       {
#  860|         perror ("couldn't set peer stdin/stout file descriptors");

Error: GCC_ANALYZER_WARNING (CWE-775): [#def2]
cockpit-321-build/cockpit-321/src/bridge/cockpitpeer.c:858:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd, 1)’
#  856|     prctl (PR_SET_PDEATHSIG, SIGHUP);
#  857|   
#  858|->   if (dup2 (fd, 0) < 0 || dup2 (fd, 1) < 0)
#  859|       {
#  860|         perror ("couldn't set peer stdin/stout file descriptors");

Error: CPPCHECK_WARNING (CWE-457): [#def3]
cockpit-321-build/cockpit-321/src/bridge/cockpitrouter.c:326: error[legacyUninitvar]: Uninitialized variable: host
#  324|       {
#  325|         g_debug ("received init message");
#  326|->       g_assert (host != NULL);
#  327|         self->init_host = g_strdup (host);
#  328|         problem = NULL;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def4]
cockpit-321-build/cockpit-321/src/common/cockpitpipe.c: scope_hint: In function ‘spawn_setup’
cockpit-321-build/cockpit-321/src/common/cockpitpipe.c:1279:1: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘r’
/usr/lib64/glib-2.0/include/glibconfig.h:9: included_from: Included from here.
/usr/include/glib-2.0/glib/gtypes.h:34: included_from: Included from here.
/usr/include/glib-2.0/glib/galloca.h:34: included_from: Included from here.
/usr/include/glib-2.0/glib.h:32: included_from: Included from here.
/usr/include/glib-2.0/gobject/gbinding.h:30: included_from: Included from here.
/usr/include/glib-2.0/glib-object.h:24: included_from: Included from here.
/usr/include/glib-2.0/gio/gioenums.h:30: included_from: Included from here.
/usr/include/glib-2.0/gio/giotypes.h:30: included_from: Included from here.
/usr/include/glib-2.0/gio/gio.h:28: included_from: Included from here.
cockpit-321-build/cockpit-321/src/common/cockpitpipe.h:23: included_from: Included from here.
cockpit-321-build/cockpit-321/src/common/cockpitpipe.c:22: included_from: Included from here.
/usr/include/glib-2.0/glib/gmacros.h:1243:31: note: in expansion of macro ‘_G_BOOLEAN_EXPR_IMPL’
/usr/include/glib-2.0/glib/gmacros.h:1244:43: note: in expansion of macro ‘_G_BOOLEAN_EXPR’
/usr/include/glib-2.0/glib/gtestutils.h:276:49: note: in expansion of macro ‘G_LIKELY’
cockpit-321-build/cockpit-321/src/common/cockpitpipe.c:1277:5: note: in expansion of macro ‘g_assert’
# 1277|       g_assert (r == 2); /* that should really never fail */
# 1278|     }
# 1279|-> }
# 1280|   
# 1281|   /**

Error: GCC_ANALYZER_WARNING (CWE-688): [#def5]
cockpit-321-build/cockpit-321/src/common/cockpitwebresponse.c: scope_hint: In function ‘find_extension’
cockpit-321-build/cockpit-321/src/common/cockpitwebresponse.c:1568:9: warning[-Wanalyzer-null-argument]: use of NULL ‘path’ where non-null expected
/usr/include/glib-2.0/glib/gstring.h:37: included_from: Included from here.
/usr/include/glib-2.0/glib/giochannel.h:36: included_from: Included from here.
/usr/include/glib-2.0/glib.h:56: included_from: Included from here.
/usr/include/glib-2.0/gobject/gbinding.h:30: included_from: Included from here.
/usr/include/glib-2.0/glib-object.h:24: included_from: Included from here.
/usr/include/glib-2.0/gio/gioenums.h:30: included_from: Included from here.
/usr/include/glib-2.0/gio/giotypes.h:30: included_from: Included from here.
/usr/include/glib-2.0/gio/gio.h:28: included_from: Included from here.
cockpit-321-build/cockpit-321/src/common/cockpitwebresponse.h:23: included_from: Included from here.
cockpit-321-build/cockpit-321/src/common/cockpitwebresponse.c:28: included_from: Included from here.
cockpit-321-build/cockpit-321/src/common/cockpitwebresponse.c:1662:14: note: in expansion of macro ‘g_strdup’
/usr/lib64/glib-2.0/include/glibconfig.h:9: included_from: Included from here.
/usr/include/glib-2.0/glib/gtypes.h:34: included_from: Included from here.
/usr/include/glib-2.0/glib/galloca.h:34: included_from: Included from here.
/usr/include/glib-2.0/glib.h:32: included_from: Included from here.
/usr/include/glib-2.0/glib/gmacros.h:1358:7: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’
/usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’
/usr/include/glib-2.0/glib/glib-autocleanups.h:69:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’
/usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’
/usr/include/glib-2.0/glib/glib-autocleanups.h:69:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’
/usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’
/usr/include/glib-2.0/glib/glib-autocleanups.h:69:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’
cockpit-321-build/cockpit-321/src/common/cockpitwebresponse.c: scope_hint: In function ‘find_extension’
/usr/include/glib-2.0/glib/galloca.h:35: included_from: Included from here.
/usr/include/string.h:273:14: note: argument 1 of ‘strrchr’ must be non-null
# 1566|     const gchar *slash;
# 1567|   
# 1568|->   dot = strrchr (path, '.');
# 1569|     slash = strrchr (path, '/');
# 1570|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def6]
cockpit-321-build/cockpit-321/src/common/cockpitwebserver.c:832:18: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
cockpit-321-build/cockpit-321/src/common/cockpitwebserver.c:825:33: note: in expansion of macro ‘g_strdup’
cockpit-321-build/cockpit-321/src/common/cockpitwebserver.c: scope_hint: In function ‘cockpit_web_request_process’
<built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null
#  830|     self->host = host;
#  831|   
#  832|->   gchar *query = strchr (path_copy, '?');
#  833|     if (query)
#  834|       {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def7]
cockpit-321-build/cockpit-321/src/common/cockpitwebserver.c: scope_hint: In function ‘cockpit_web_request_process’
cockpit-321-build/cockpit-321/src/common/cockpitwebserver.c:832:18: warning[-Wanalyzer-null-argument]: use of NULL ‘*self.original_path’ where non-null expected
/usr/include/glib-2.0/glib.h:52: included_from: Included from here.
/usr/include/glib-2.0/gobject/gbinding.h:30: included_from: Included from here.
/usr/include/glib-2.0/glib-object.h:24: included_from: Included from here.
/usr/include/glib-2.0/gio/gioenums.h:30: included_from: Included from here.
/usr/include/glib-2.0/gio/giotypes.h:30: included_from: Included from here.
/usr/include/glib-2.0/gio/gio.h:28: included_from: Included from here.
cockpit-321-build/cockpit-321/src/common/cockpitwebserver.h:23: included_from: Included from here.
cockpit-321-build/cockpit-321/src/common/cockpitwebserver.c:22: included_from: Included from here.
cockpit-321-build/cockpit-321/src/common/cockpitwebserver.c:941:8: note: in expansion of macro ‘g_str_equal’
/usr/include/glib-2.0/glib/gstring.h:37: included_from: Included from here.
/usr/include/glib-2.0/glib/giochannel.h:36: included_from: Included from here.
/usr/include/glib-2.0/glib.h:56: included_from: Included from here.
cockpit-321-build/cockpit-321/src/common/cockpitwebserver.c:825:33: note: in expansion of macro ‘g_strdup’
cockpit-321-build/cockpit-321/src/common/cockpitwebserver.c: scope_hint: In function ‘cockpit_web_request_process’
<built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null
#  830|     self->host = host;
#  831|   
#  832|->   gchar *query = strchr (path_copy, '?');
#  833|     if (query)
#  834|       {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def8]
cockpit-321-build/cockpit-321/src/session/session-utils.c: scope_hint: In function ‘scan_btmp’
cockpit-321-build/cockpit-321/src/session/session-utils.c:351:6: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/var/log/btmp", 524288)’
cockpit-321-build/cockpit-321/src/session/session-utils.h:24: included_from: Included from here.
cockpit-321-build/cockpit-321/src/session/session-utils.c:22: included_from: Included from here.
#  349|   
#  350|   out:
#  351|->   if (fd > -1)
#  352|       close (fd);
#  353|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def9]
cockpit-321-build/cockpit-321/src/session/session-utils.c: scope_hint: In function ‘fd_remap’
cockpit-321-build/cockpit-321/src/session/session-utils.c:537:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(*<unknown>,  i)’
#  535|     for (int i = 0; i < n_remap_fds; i++)
#  536|       if (fds[i] != -1) /* no-op */
#  537|->       if (dup2 (fds[i], i) != i)
#  538|           abort_with_message ("dup2(%d, %d) failed: %m", fds[i], i);
#  539|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def10]
cockpit-321-build/cockpit-321/src/tls/server.c: scope_hint: In function ‘server_init’
cockpit-321-build/cockpit-321/src/tls/server.c:243:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘server.first_listener’
cockpit-321-build/cockpit-321/src/tls/server.c:24: included_from: Included from here.
#  241|           err (EXIT_FAILURE, "failed to bind to port %hu", port);
#  242|         if (listen (server.first_listener, 1024) < 0)
#  243|->         err (EXIT_FAILURE, "failed to listen to server port");
#  244|         debug (SERVER, "Server ready. Listening on port %hu, fd %i", port, server.first_listener);
#  245|       }

Error: GCC_ANALYZER_WARNING (CWE-775): [#def11]
cockpit-321-build/cockpit-321/src/tls/server.c:248:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘server.first_listener’
#  246|   
#  247|     /* epoll the listening fds */
#  248|->   server.epollfd = epoll_create1 (EPOLL_CLOEXEC);
#  249|     if (server.epollfd < 0)
#  250|       err (EXIT_FAILURE, "Failed to create epoll fd");

Error: GCC_ANALYZER_WARNING (CWE-775): [#def12]
cockpit-321-build/cockpit-321/src/ws/cockpitauth.c: scope_hint: In function ‘session_child_setup’
cockpit-321-build/cockpit-321/src/ws/cockpitauth.c:454:6: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(*(ChildData *)data.io, 0)’
#  452|     ChildData *child = data;
#  453|   
#  454|->   if (dup2 (child->io, 0) < 0 || dup2 (child->io, 1) < 0)
#  455|       {
#  456|         g_printerr ("couldn't set child stdin/stout file descriptors\n");

Error: GCC_ANALYZER_WARNING (CWE-775): [#def13]
cockpit-321-build/cockpit-321/src/ws/cockpitauth.c:454:31: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(*(ChildData *)data.io, 1)’
#  452|     ChildData *child = data;
#  453|   
#  454|->   if (dup2 (child->io, 0) < 0 || dup2 (child->io, 1) < 0)
#  455|       {
#  456|         g_printerr ("couldn't set child stdin/stout file descriptors\n");

Error: CLANG_WARNING: [#def14]
cockpit-321-build/cockpit-321/src/ws/cockpitauth.c:1127:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'argv'
# 1125|         argv[argc] = NULL;
# 1126|   
# 1127|->       pipe = session_start_process ((const gchar **) argv, (const gchar **)env, capture_stderr);
# 1128|       }
# 1129|     else if (unix_path != NULL)

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-245.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namecockpit-321-1.fc41
store-results-to/tmp/tmp7vbdpf1_/cockpit-321-1.fc41.tar.xz
time-created2024-07-11 11:13:04
time-finished2024-07-11 11:15:55
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'gcc,shellcheck,cppcheck,clang' '-o' '/tmp/tmp7vbdpf1_/cockpit-321-1.fc41.tar.xz' '--gcc-analyze' '--cppcheck-add-flag=--check-level=exhaustive' '/tmp/tmp7vbdpf1_/cockpit-321-1.fc41.src.rpm'
tool-versioncsmock-3.6.0-1.el9