Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
shadow-4.18.0/src/newgrp.c:256:9: warning[-Wanalyzer-malloc-leak]: leak of ‘tty’
shadow-4.18.0/src/newgrp.c:365:5: enter_function: entry to ‘main’
shadow-4.18.0/src/newgrp.c:436:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:448:9: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:517:28: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:523:25: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:552:16: call_function: calling ‘agetgroups’ from ‘main’
shadow-4.18.0/src/newgrp.c:552:16: return_function: returning to ‘main’ from ‘agetgroups’
shadow-4.18.0/src/newgrp.c:553:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:607:15: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:608:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:617:22: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:649:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:657:13: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:657:12: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:658:17: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:658:17: call_function: calling ‘syslog_sg’ from ‘main’
#  254|   	tty = strprefix(tty, "/dev/") ?: tty;
#  255|   
#  256|-> 	SYSLOG ((LOG_INFO,
#  257|   		 "user '%s' (login '%s' on %s) switched to group '%s'",
#  258|   		 name, loginname, tty, group));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
shadow-4.18.0/src/newgrp.c:297:33: warning[-Wanalyzer-malloc-leak]: leak of ‘free_tty’
shadow-4.18.0/src/newgrp.c:233:13: enter_function: entry to ‘syslog_sg’
shadow-4.18.0/src/newgrp.c:243:12: branch_true: following ‘true’ branch (when ‘tty’ is non-NULL)...
shadow-4.18.0/src/newgrp.c:244:28: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:244:28: call_function: calling ‘xstrdup’ from ‘syslog_sg’
shadow-4.18.0/src/newgrp.c:244:28: return_function: returning to ‘syslog_sg’ from ‘xstrdup’
shadow-4.18.0/src/newgrp.c:248:12: branch_true: following ‘true’ branch (when ‘loginname’ is NULL)...
shadow-4.18.0/src/newgrp.c:248:12: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:251:12: branch_false: following ‘false’ branch (when ‘tty’ is non-NULL)...
shadow-4.18.0/src/newgrp.c:254:15: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:254:15: call_function: calling ‘strprefix_’ from ‘syslog_sg’
shadow-4.18.0/src/newgrp.c:254:15: return_function: returning to ‘syslog_sg’ from ‘strprefix_’
shadow-4.18.0/src/newgrp.c:254:15: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:256:9: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:256:9: branch_false: following ‘false’ branch (when ‘saved_locale’ is NULL)...
shadow-4.18.0/src/newgrp.c:281:24: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:291:20: branch_true: following ‘true’ branch (when ‘child == -1’)...
shadow-4.18.0/src/newgrp.c:294:73: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:296:28: branch_true: following ‘true’ branch (when ‘group’ is non-NULL)...
shadow-4.18.0/src/newgrp.c:298:57: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:297:33: throw: if ‘audit_logger_with_group’ throws an exception...
shadow-4.18.0/src/newgrp.c:297:33: danger: ‘free_tty’ leaks here; was allocated at [(7)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/6)
#  295|   #ifdef WITH_AUDIT
#  296|   			if (group) {
#  297|-> 				audit_logger_with_group(AUDIT_CHGRP_ID, "changing", NULL,
#  298|   							getuid(), "new_group", group,
#  299|   							SHADOW_AUDIT_FAILURE);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
shadow-4.18.0/src/newgrp.c:301:33: warning[-Wanalyzer-malloc-leak]: leak of ‘free_tty’
shadow-4.18.0/src/newgrp.c:233:13: enter_function: entry to ‘syslog_sg’
shadow-4.18.0/src/newgrp.c:243:12: branch_true: following ‘true’ branch (when ‘tty’ is non-NULL)...
shadow-4.18.0/src/newgrp.c:244:28: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:244:28: call_function: calling ‘xstrdup’ from ‘syslog_sg’
shadow-4.18.0/src/newgrp.c:244:28: return_function: returning to ‘syslog_sg’ from ‘xstrdup’
shadow-4.18.0/src/newgrp.c:248:12: branch_true: following ‘true’ branch (when ‘loginname’ is NULL)...
shadow-4.18.0/src/newgrp.c:248:12: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:251:12: branch_false: following ‘false’ branch (when ‘tty’ is non-NULL)...
shadow-4.18.0/src/newgrp.c:254:15: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:254:15: call_function: calling ‘strprefix_’ from ‘syslog_sg’
shadow-4.18.0/src/newgrp.c:254:15: return_function: returning to ‘syslog_sg’ from ‘strprefix_’
shadow-4.18.0/src/newgrp.c:254:15: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:256:9: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:256:9: branch_false: following ‘false’ branch (when ‘saved_locale’ is NULL)...
shadow-4.18.0/src/newgrp.c:281:24: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:291:20: branch_true: following ‘true’ branch (when ‘child == -1’)...
shadow-4.18.0/src/newgrp.c:294:73: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:296:28: branch_false: following ‘false’ branch (when ‘group’ is NULL)...
shadow-4.18.0/src/newgrp.c:302:65: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:301:33: throw: if ‘audit_logger’ throws an exception...
shadow-4.18.0/src/newgrp.c:301:33: danger: ‘free_tty’ leaks here; was allocated at [(7)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/6)
#  299|   							SHADOW_AUDIT_FAILURE);
#  300|   			} else {
#  301|-> 				audit_logger (AUDIT_CHGRP_ID, Prog,
#  302|   				              "changing", NULL, getuid(),
#  303|   				              SHADOW_AUDIT_FAILURE);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
shadow-4.18.0/src/newgrp.c:311:45: warning[-Wanalyzer-malloc-leak]: leak of ‘tty’
shadow-4.18.0/src/newgrp.c:365:5: enter_function: entry to ‘main’
shadow-4.18.0/src/newgrp.c:436:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:448:9: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:517:28: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:523:25: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:552:16: call_function: calling ‘agetgroups’ from ‘main’
shadow-4.18.0/src/newgrp.c:552:16: return_function: returning to ‘main’ from ‘agetgroups’
shadow-4.18.0/src/newgrp.c:553:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:607:15: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:608:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:617:22: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:649:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:657:13: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:657:12: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:658:17: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:658:17: call_function: calling ‘syslog_sg’ from ‘main’
#  309|   			int cst = 0;
#  310|   			gid_t gid = getgid();
#  311|-> 			struct group *grp = getgrgid (gid);
#  312|   			pid_t pid;
#  313|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
shadow-4.18.0/src/newgrp.c:316:39: warning[-Wanalyzer-malloc-leak]: leak of ‘tty’
shadow-4.18.0/src/newgrp.c:365:5: enter_function: entry to ‘main’
shadow-4.18.0/src/newgrp.c:436:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:448:9: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:517:28: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:523:25: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:552:16: call_function: calling ‘agetgroups’ from ‘main’
shadow-4.18.0/src/newgrp.c:552:16: return_function: returning to ‘main’ from ‘agetgroups’
shadow-4.18.0/src/newgrp.c:553:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:607:15: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:608:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:617:22: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:649:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:657:13: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:657:12: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:658:17: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:658:17: call_function: calling ‘syslog_sg’ from ‘main’
#  314|   			do {
#  315|   				errno = 0;
#  316|-> 				pid = waitpid (child, &cst, WUNTRACED);
#  317|   				if ((pid == child) && (WIFSTOPPED (cst) != 0)) {
#  318|   					/* The child (shell) was suspended.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
shadow-4.18.0/src/newgrp.c:328:33: warning[-Wanalyzer-malloc-leak]: leak of ‘tty’
shadow-4.18.0/src/newgrp.c:365:5: enter_function: entry to ‘main’
shadow-4.18.0/src/newgrp.c:436:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:448:9: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:517:28: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:523:25: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:552:16: call_function: calling ‘agetgroups’ from ‘main’
shadow-4.18.0/src/newgrp.c:552:16: return_function: returning to ‘main’ from ‘agetgroups’
shadow-4.18.0/src/newgrp.c:553:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:607:15: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:608:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:617:22: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:649:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:657:13: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:657:12: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:658:17: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:658:17: call_function: calling ‘syslog_sg’ from ‘main’
#  326|   			/* local, no need for xgetgrgid */
#  327|   			if (NULL != grp) {
#  328|-> 				SYSLOG ((LOG_INFO,
#  329|   				         "user '%s' (login '%s' on %s) returned to group '%s'",
#  330|   				         name, loginname, tty, grp->gr_name));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
shadow-4.18.0/src/newgrp.c:332:33: warning[-Wanalyzer-malloc-leak]: leak of ‘tty’
shadow-4.18.0/src/newgrp.c:365:5: enter_function: entry to ‘main’
shadow-4.18.0/src/newgrp.c:436:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:448:9: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:517:28: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:523:25: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:552:16: call_function: calling ‘agetgroups’ from ‘main’
shadow-4.18.0/src/newgrp.c:552:16: return_function: returning to ‘main’ from ‘agetgroups’
shadow-4.18.0/src/newgrp.c:553:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:607:15: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:608:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:617:22: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:649:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:657:13: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:657:12: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:658:17: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:658:17: call_function: calling ‘syslog_sg’ from ‘main’
#  330|   				         name, loginname, tty, grp->gr_name));
#  331|   			} else {
#  332|-> 				SYSLOG ((LOG_INFO,
#  333|   				         "user '%s' (login '%s' on %s) returned to group '%lu'",
#  334|   				         name, loginname, tty,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
shadow-4.18.0/src/newgrp.c:340:33: warning[-Wanalyzer-malloc-leak]: leak of ‘tty’
shadow-4.18.0/src/newgrp.c:365:5: enter_function: entry to ‘main’
shadow-4.18.0/src/newgrp.c:436:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:448:9: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:517:28: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:523:25: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:552:16: call_function: calling ‘agetgroups’ from ‘main’
shadow-4.18.0/src/newgrp.c:552:16: return_function: returning to ‘main’ from ‘agetgroups’
shadow-4.18.0/src/newgrp.c:553:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:607:15: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:608:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:617:22: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:649:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:657:13: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:657:12: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:658:17: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:658:17: call_function: calling ‘syslog_sg’ from ‘main’
#  338|   				 * or the group was deleted while the user
#  339|   				 * was in a newgrp session.*/
#  340|-> 				SYSLOG ((LOG_WARN,
#  341|   				         "unknown GID '%lu' used by user '%s'",
#  342|   				         (unsigned long) gid, name));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
shadow-4.18.0/src/newgrp.c:344:25: warning[-Wanalyzer-malloc-leak]: leak of ‘tty’
shadow-4.18.0/src/newgrp.c:365:5: enter_function: entry to ‘main’
shadow-4.18.0/src/newgrp.c:436:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:448:9: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:517:28: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:523:25: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:552:16: call_function: calling ‘agetgroups’ from ‘main’
shadow-4.18.0/src/newgrp.c:552:16: return_function: returning to ‘main’ from ‘agetgroups’
shadow-4.18.0/src/newgrp.c:553:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:607:15: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:608:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:617:22: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:649:12: branch_false: following ‘false’ branch...
shadow-4.18.0/src/newgrp.c:657:13: branch_false: ...to here
shadow-4.18.0/src/newgrp.c:657:12: branch_true: following ‘true’ branch...
shadow-4.18.0/src/newgrp.c:658:17: branch_true: ...to here
shadow-4.18.0/src/newgrp.c:658:17: call_function: calling ‘syslog_sg’ from ‘main’
#  342|   				         (unsigned long) gid, name));
#  343|   			}
#  344|-> 			closelog ();
#  345|   			exit ((0 != WIFEXITED (cst)) ? WEXITSTATUS (cst)
#  346|   			                             : WTERMSIG (cst) + 128);

Scan Properties

analyzer-version-clippy1.92.0
analyzer-version-cppcheck2.19.1
analyzer-version-gcc16.0.0
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.92.0
diffbase-analyzer-version-cppcheck2.19.1
diffbase-analyzer-version-gcc16.0.0
diffbase-analyzer-version-gcc-analyzer16.0.0
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-222.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.20250521.132812.g8eff701.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-nameshadow-utils-4.18.0-7.fc44
diffbase-store-results-to/tmp/tmpdynbloaw/shadow-utils-4.18.0-7.fc44.tar.xz
diffbase-time-created2026-01-08 21:45:22
diffbase-time-finished2026-01-08 21:48:25
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpdynbloaw/shadow-utils-4.18.0-7.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpdynbloaw/shadow-utils-4.18.0-7.fc44.src.rpm'
diffbase-tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-222.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-nameshadow-utils-4.18.0-3.fc43
store-results-to/tmp/tmpk9012n5g/shadow-utils-4.18.0-3.fc43.tar.xz
time-created2026-01-08 21:41:16
time-finished2026-01-08 21:44:43
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpk9012n5g/shadow-utils-4.18.0-3.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpk9012n5g/shadow-utils-4.18.0-3.fc43.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9