Task #92085 - fixed.err

back to task #92085
download
Error: GCC_ANALYZER_WARNING (CWE-401):
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):
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):
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):
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):
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):
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):
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):
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):
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);