Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
shadow-utils-4.15.1-build/shadow-4.15.1/lib/sgetgrent.c:18: included_from: Included from here.
shadow-utils-4.15.1-build/shadow-4.15.1/lib/alloc.h: scope_hint: In function ‘reallocarrayf’
shadow-utils-4.15.1-build/shadow-4.15.1/lib/alloc.h:103:15: warning[-Wanalyzer-malloc-leak]: leak of ‘reallocarrayf(p_,  i + 100, 8)’
shadow-utils-4.15.1-build/shadow-4.15.1/lib/sgetgrent.c:49:35: note: in expansion of macro ‘REALLOCF’
shadow-utils-4.15.1-build/shadow-4.15.1/lib/sgetgrent.c:49:35: note: in expansion of macro ‘REALLOCF’
#  101|   
#  102|   	/* realloc(p, 0) is equivalent to free(p);  avoid double free.  */
#  103|-> 	if (q == NULL && nmemb != 0 && size != 0)
#  104|   		free(p);
#  105|   	return q;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def2]
shadow-utils-4.15.1-build/shadow-4.15.1/lib/list.c:236:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘xreallocarray(0, (long unsigned int)i, 8)’
shadow-utils-4.15.1-build/shadow-4.15.1/lib/list.c:218:17: note: in expansion of macro ‘XMALLOC’
shadow-utils-4.15.1-build/shadow-4.15.1/lib/list.c: scope_hint: In function ‘comma_to_list’
#  234|   
#  235|   	for (cp = members, i = 0;; i++) {
#  236|-> 		array[i] = cp;
#  237|   		cp2 = strchr (cp, ',');
#  238|   		if (NULL != cp2) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def3]
shadow-utils-4.15.1-build/shadow-4.15.1/lib/utmp.c:29: included_from: Included from here.
shadow-utils-4.15.1-build/shadow-4.15.1/lib/string/zustr2stp.h: scope_hint: In function ‘zustr2stp’
shadow-utils-4.15.1-build/shadow-4.15.1/lib/string/zustr2stp.h:75:23: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘dst’ where non-null expected
shadow-utils-4.15.1-build/shadow-4.15.1/lib/string/zustr2stp.h:13: included_from: Included from here.
shadow-utils-4.15.1-build/shadow-4.15.1/lib/utmp.c:25: included_from: Included from here.
shadow-utils-4.15.1-build/shadow-4.15.1/lib/utmp.c:264:28: note: in expansion of macro ‘XMALLOC’
shadow-utils-4.15.1-build/shadow-4.15.1/lib/utmp.c: scope_hint: In function ‘zustr2stp’
shadow-utils-4.15.1-build/shadow-4.15.1/lib/utmp.c:265:17: note: in expansion of macro ‘ZUSTR2STP’
shadow-utils-4.15.1-build/shadow-4.15.1/lib/defines.h:30: included_from: Included from here.
shadow-utils-4.15.1-build/shadow-4.15.1/lib/utmp.c:12: included_from: Included from here.
/usr/include/string.h:400:14: note: argument 1 of ‘mempcpy’ must be non-null
#   73|   zustr2stp(char *restrict dst, const char *restrict src, size_t sz)
#   74|   {
#   75|-> 	return stpcpy(mempcpy(dst, src, strnlen(src, sz)), "");
#   76|   }
#   77|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
shadow-utils-4.15.1-build/shadow-4.15.1/src/id.c: scope_hint: In function ‘main’
shadow-utils-4.15.1-build/shadow-4.15.1/src/id.c:77:20: warning[-Wanalyzer-malloc-leak]: leak of ‘reallocarray(0, (long unsigned int)sys_ngroups, 4)’
shadow-utils-4.15.1-build/shadow-4.15.1/src/id.c:27: included_from: Included from here.
shadow-utils-4.15.1-build/shadow-4.15.1/src/id.c:69:18: note: in expansion of macro ‘MALLOC’
shadow-utils-4.15.1-build/shadow-4.15.1/src/id.c: scope_hint: In function ‘main’
#   75|   
#   76|   	if (argc > 1) {
#   77|-> 		if ((argc > 2) || (strcmp (argv[1], "-a") != 0)) {
#   78|   			usage ();
#   79|   		} else {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
shadow-utils-4.15.1-build/shadow-4.15.1/src/id.c:77:36: warning[-Wanalyzer-malloc-leak]: leak of ‘reallocarray(0, (long unsigned int)sys_ngroups, 4)’
shadow-utils-4.15.1-build/shadow-4.15.1/src/id.c:69:18: note: in expansion of macro ‘MALLOC’
shadow-utils-4.15.1-build/shadow-4.15.1/src/id.c: scope_hint: In function ‘main’
#   75|   
#   76|   	if (argc > 1) {
#   77|-> 		if ((argc > 2) || (strcmp (argv[1], "-a") != 0)) {
#   78|   			usage ();
#   79|   		} else {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def6]
shadow-utils-4.15.1-build/shadow-4.15.1/src/sulogin.c: scope_hint: In function ‘main’
shadow-utils-4.15.1-build/shadow-4.15.1/src/sulogin.c:87:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(argv[1], 2)’
#   85|   		close (2);
#   86|   
#   87|-> 		if (open (argv[1], O_RDWR) >= 0) {
#   88|   			dup (0);
#   89|   			dup (0);

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-218.us-west-2.compute.internal
diffbase-mock-configfedora-rawhide-gcc-latest-x86_64
diffbase-project-nameshadow-utils-4.16.0-7.fc42
diffbase-store-results-to/tmp/tmpfq3nx0vz/shadow-utils-4.16.0-7.fc42.tar.xz
diffbase-time-created2024-11-13 03:14:34
diffbase-time-finished2024-11-13 03:18:10
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpfq3nx0vz/shadow-utils-4.16.0-7.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpfq3nx0vz/shadow-utils-4.16.0-7.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-218.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-nameshadow-utils-4.15.1-12.fc41
store-results-to/tmp/tmpvdzqrobs/shadow-utils-4.15.1-12.fc41.tar.xz
time-created2024-11-13 03:10:07
time-finished2024-11-13 03:14:09
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpvdzqrobs/shadow-utils-4.15.1-12.fc41.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpvdzqrobs/shadow-utils-4.15.1-12.fc41.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9