shadow-utils-4.19.3-2.fc45

List of Findings

Error: COMPILER_WARNING (CWE-252): [#def1]
shadow-4.19.3/lib/audit_help.c: scope_hint: In function 'audit_logger'
shadow-4.19.3/lib/audit_help.c:71:17: warning[-Wunused-result]: ignoring return value of 'audit_log_acct_message' declared with attribute 'warn_unused_result'
#   71 |                 audit_log_acct_message (audit_fd, type, NULL, op, name, id,
#      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   72 |                                         NULL, NULL, NULL, result);
#      |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
#   69|   		return;
#   70|   	} else {
#   71|-> 		audit_log_acct_message (audit_fd, type, NULL, op, name, id,
#   72|   		                        NULL, NULL, NULL, result);
#   73|   	}

Error: COMPILER_WARNING (CWE-252): [#def2]
shadow-4.19.3/lib/audit_help.c: scope_hint: In function 'audit_logger_with_group'
shadow-4.19.3/lib/audit_help.c:113:9: warning[-Wunused-result]: ignoring return value of 'audit_log_acct_message' declared with attribute 'warn_unused_result'
#  113 |         audit_log_acct_message(audit_fd, type, NULL, buf, name, id,
#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  114 |                                NULL, NULL, NULL, result);
#      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~
#  111|   	}
#  112|   
#  113|-> 	audit_log_acct_message(audit_fd, type, NULL, buf, name, id,
#  114|   		               NULL, NULL, NULL, result);
#  115|   }

Error: COMPILER_WARNING (CWE-252): [#def3]
shadow-4.19.3/lib/audit_help.c: scope_hint: In function 'audit_logger_message'
shadow-4.19.3/lib/audit_help.c:122:17: warning[-Wunused-result]: ignoring return value of 'audit_log_user_message' declared with attribute 'warn_unused_result'
#  122 |                 audit_log_user_message (audit_fd,
#      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  123 |                                         AUDIT_USYS_CONFIG,
#      |                                         ~~~~~~~~~~~~~~~~~~
#  124 |                                         message,
#      |                                         ~~~~~~~~
#  125 |                                         NULL, /* hostname */
#      |                                         ~~~~~~~~~~~~~~~~~~~~
#  126 |                                         NULL, /* addr */
#      |                                         ~~~~~~~~~~~~~~~~
#  127 |                                         NULL, /* tty */
#      |                                         ~~~~~~~~~~~~~~~
#  128 |                                         result);
#      |                                         ~~~~~~~
#  120|   		return;
#  121|   	} else {
#  122|-> 		audit_log_user_message (audit_fd,
#  123|   		                        AUDIT_USYS_CONFIG,
#  124|   		                        message,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
shadow-4.19.3/lib/copydir.c:233:22: warning[-Wanalyzer-malloc-leak]: leak of 'reallocarray(0, 1, 40)'
shadow-4.19.3/lib/copydir.c:871:5: enter_function: entry to 'copy_tree'
shadow-4.19.3/lib/copydir.c:887:16: call_function: calling 'copy_tree_impl' from 'copy_tree'
#  231|   
#  232|   	lp = xmalloc_T(1, struct link_name);
#  233|-> 	lp->ln_dev = sb->st_dev;
#  234|   	lp->ln_ino = sb->st_ino;
#  235|   	lp->ln_count = sb->st_nlink;

Error: CPPCHECK_WARNING (CWE-476): [#def5]
shadow-4.19.3/lib/env.c:92: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: newstring
#   90|   	 */
#   91|   
#   92|-> 	cp = strchr (newstring, '=');
#   93|   	if (NULL == cp) {
#   94|   		free(newstring);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
shadow-4.19.3/lib/exit_if_null.h:41:12: warning[-Wanalyzer-malloc-leak]: leak of ‘reallocarray(0, n_args + 3, 8)’
shadow-4.19.3/src/su.c:236:13: enter_function: entry to ‘execve_shell’
shadow-4.19.3/src/su.c:244:12: branch_true: following ‘true’ branch...
shadow-4.19.3/src/su.c:244:12: branch_true: ...to here
shadow-4.19.3/src/su.c:254:25: call_function: inlined call to ‘mallocarray’ from ‘execve_shell’
shadow-4.19.3/src/su.c:254:25: call_function: inlined call to ‘exit_if_null_’ from ‘execve_shell’
shadow-4.19.3/src/su.c:255:17: branch_false: ...to here
shadow-4.19.3/src/su.c:257:28: call_function: inlined call to ‘exit_if_null_’ from ‘execve_shell’
#   39|   exit_if_null_(void *p)
#   40|   {
#   41|-> 	if (p == NULL) {
#   42|   		fprintf(log_get_logfd(), "%s: %s\n", log_get_progname(), strerrno());
#   43|   		exit(13);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def7]
shadow-4.19.3/lib/fd.c:39:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open("/dev/null", 2)'
shadow-4.19.3/lib/fd.c:38:19: acquire_resource: opened here
shadow-4.19.3/lib/fd.c:39:12: danger: 'open("/dev/null", 2)' leaks here; was opened at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   37|   
#   38|   	devnull = open("/dev/null", O_RDWR);
#   39|-> 	if (devnull != fd)
#   40|   		abort();
#   41|   }

Error: GCC_ANALYZER_WARNING (CWE-122): [#def8]
shadow-4.19.3/lib/find_new_gid.c:128:34: warning[-Wanalyzer-out-of-bounds]: heap-based buffer over-read
shadow-4.19.3/lib/find_new_gid.c:157:5: enter_function: entry to 'find_new_gid'
shadow-4.19.3/lib/find_new_gid.c:169:9: branch_true: following 'true' branch (when 'gid' is non-NULL)...
shadow-4.19.3/lib/find_new_gid.c:175:18: branch_true: ...to here
shadow-4.19.3/lib/find_new_gid.c:175:18: call_function: calling 'get_ranges' from 'find_new_gid'
shadow-4.19.3/lib/find_new_gid.c:175:18: return_function: returning to 'find_new_gid' from 'get_ranges'
shadow-4.19.3/lib/find_new_gid.c:176:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/find_new_gid.c:181:12: branch_false: ...to here
shadow-4.19.3/lib/find_new_gid.c:239:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/find_new_gid.c:247:16: branch_false: ...to here
shadow-4.19.3/lib/find_new_gid.c:250:16: branch_false: following 'false' branch...
shadow-4.19.3/lib/find_new_gid.c:275:12: branch_false: ...to here
shadow-4.19.3/lib/find_new_gid.c:275:12: branch_true: following 'true' branch (when 'sys_group != 0')...
shadow-4.19.3/lib/find_new_gid.c:285:20: branch_true: ...to here
shadow-4.19.3/lib/find_new_gid.c:301:41: branch_true: following 'true' branch (when 'id >= highest_found')...
shadow-4.19.3/lib/find_new_gid.c:302:34: branch_true: ...to here
shadow-4.19.3/lib/find_new_gid.c:303:28: branch_false: following 'false' branch...
shadow-4.19.3/lib/find_new_gid.c:308:36: branch_false: ...to here
shadow-4.19.3/lib/find_new_gid.c:308:35: branch_true: following 'true' branch...
shadow-4.19.3/lib/find_new_gid.c:301:56: branch_true: ...to here
shadow-4.19.3/lib/find_new_gid.c:301:41: branch_true: following 'true' branch (when 'id >= highest_found')...
shadow-4.19.3/lib/find_new_gid.c:302:34: branch_true: ...to here
shadow-4.19.3/lib/find_new_gid.c:302:34: call_function: calling 'check_gid' from 'find_new_gid'
#  126|   	 * using the gr_next() loop
#  127|   	 */
#  128|-> 	if (used_gids != NULL && used_gids[gid]) {
#  129|   		return EEXIST;
#  130|   	}

Error: GCC_ANALYZER_WARNING (CWE-122): [#def9]
shadow-4.19.3/lib/find_new_uid.c:127:34: warning[-Wanalyzer-out-of-bounds]: heap-based buffer over-read
shadow-4.19.3/lib/find_new_uid.c:156:5: enter_function: entry to 'find_new_uid'
shadow-4.19.3/lib/find_new_uid.c:168:9: branch_true: following 'true' branch (when 'uid' is non-NULL)...
shadow-4.19.3/lib/find_new_uid.c:174:18: branch_true: ...to here
shadow-4.19.3/lib/find_new_uid.c:174:18: call_function: calling 'get_ranges' from 'find_new_uid'
shadow-4.19.3/lib/find_new_uid.c:174:18: return_function: returning to 'find_new_uid' from 'get_ranges'
shadow-4.19.3/lib/find_new_uid.c:175:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/find_new_uid.c:180:12: branch_false: ...to here
shadow-4.19.3/lib/find_new_uid.c:238:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/find_new_uid.c:246:16: branch_false: ...to here
shadow-4.19.3/lib/find_new_uid.c:249:16: branch_false: following 'false' branch...
shadow-4.19.3/lib/find_new_uid.c:274:12: branch_false: ...to here
shadow-4.19.3/lib/find_new_uid.c:274:12: branch_true: following 'true' branch (when 'sys_user != 0')...
shadow-4.19.3/lib/find_new_uid.c:284:20: branch_true: ...to here
shadow-4.19.3/lib/find_new_uid.c:300:41: branch_true: following 'true' branch (when 'id >= highest_found')...
shadow-4.19.3/lib/find_new_uid.c:301:34: branch_true: ...to here
shadow-4.19.3/lib/find_new_uid.c:302:28: branch_false: following 'false' branch...
shadow-4.19.3/lib/find_new_uid.c:307:36: branch_false: ...to here
shadow-4.19.3/lib/find_new_uid.c:307:35: branch_true: following 'true' branch...
shadow-4.19.3/lib/find_new_uid.c:300:56: branch_true: ...to here
shadow-4.19.3/lib/find_new_uid.c:300:41: branch_true: following 'true' branch (when 'id >= highest_found')...
shadow-4.19.3/lib/find_new_uid.c:301:34: branch_true: ...to here
shadow-4.19.3/lib/find_new_uid.c:301:34: call_function: calling 'check_uid' from 'find_new_uid'
#  125|   	 * using the pw_next() loop
#  126|   	 */
#  127|-> 	if (used_uids != NULL && used_uids[uid]) {
#  128|   		return EEXIST;
#  129|   	}

Error: CPPCHECK_WARNING (CWE-457): [#def10]
shadow-4.19.3/lib/getdef.c:264: error[uninitvar]: Uninitialized variable: val
#  262|   	}
#  263|   
#  264|-> 	return val;
#  265|   }
#  266|   

Error: CPPCHECK_WARNING (CWE-457): [#def11]
shadow-4.19.3/lib/getdef.c:298: error[uninitvar]: Uninitialized variable: val
#  296|   	}
#  297|   
#  298|-> 	return val;
#  299|   }
#  300|   

Error: CPPCHECK_WARNING (CWE-457): [#def12]
shadow-4.19.3/lib/getdef.c:331: error[uninitvar]: Uninitialized variable: val
#  329|   	}
#  330|   
#  331|-> 	return val;
#  332|   }
#  333|   

Error: CPPCHECK_WARNING (CWE-457): [#def13]
shadow-4.19.3/lib/getdef.c:363: error[uninitvar]: Uninitialized variable: val
#  361|   	}
#  362|   
#  363|-> 	return val;
#  364|   }
#  365|   

Error: COMPILER_WARNING (CWE-477): [#def14]
shadow-4.19.3/lib/getdef.c: scope_hint: In function 'def_load'
shadow-4.19.3/lib/getdef.c:486:9: warning[-Wdeprecated-declarations]: 'econf_readDirs' is deprecated: Use the econf_readConfig/econf_readConfigWithCallback instead
#  486 |         error = econf_readDirs (&defs_file, vendordir, sysconfdir, "login", "defs", " \t", "#");
#      |         ^~~~~
shadow-4.19.3/lib/getdef.c:22: included_from: Included from here.
/usr/include/libeconf.h:497:1: note: declared here
#  497 | econf_readDirs(econf_file **key_file,
#      | ^~~~~~~~~~~~~~
#  484|   	def_loaded = true;
#  485|   
#  486|-> 	error = econf_readDirs (&defs_file, vendordir, sysconfdir, "login", "defs", " \t", "#");
#  487|   	if (error) {
#  488|   		if (error == ECONF_NOFILE)

Error: COMPILER_WARNING (CWE-477): [#def15]
shadow-4.19.3/lib/getdef.c:486:9: warning[-Wdeprecated-declarations]: 'econf_readDirs' is deprecated: Use the econf_readConfig/econf_readConfigWithCallback instead
#  484|   	def_loaded = true;
#  485|   
#  486|-> 	error = econf_readDirs (&defs_file, vendordir, sysconfdir, "login", "defs", " \t", "#");
#  487|   	if (error) {
#  488|   		if (error == ECONF_NOFILE)

Error: CPPCHECK_WARNING (CWE-457): [#def16]
shadow-4.19.3/lib/gettime.c:47: error[uninitvar]: Uninitialized variable: epoch
#   45|   		return fallback;
#   46|   	}
#   47|-> 	return epoch;
#   48|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def17]
shadow-4.19.3/lib/groupio.c:352:40: warning[-Wanalyzer-malloc-leak]: leak of 'calloc(members + 1, 8)'
shadow-4.19.3/lib/groupio.c:315:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/groupio.c:320:9: branch_false: ...to here
shadow-4.19.3/lib/groupio.c:322:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/groupio.c:328:20: branch_false: ...to here
shadow-4.19.3/lib/groupio.c:329:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/groupio.c:329:12: branch_false: ...to here
shadow-4.19.3/lib/groupio.c:347:23: acquire_memory: allocated here
shadow-4.19.3/lib/groupio.c:348:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/groupio.c:348:12: branch_false: ...to here
shadow-4.19.3/lib/groupio.c:352:19: branch_false: following 'false' branch...
shadow-4.19.3/lib/groupio.c:352:19: branch_false: ...to here
shadow-4.19.3/lib/groupio.c:358:19: branch_false: following 'false' branch...
shadow-4.19.3/lib/groupio.c:373:9: branch_false: ...to here
shadow-4.19.3/lib/groupio.c:352:40: danger: 'calloc(members + 1, 8)' leaks here; was allocated at [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#  350|   		return NULL;
#  351|   	}
#  352|-> 	for (i=0; NULL != gptr1->gr_mem[i]; i++) {
#  353|   		new_members[i] = gptr1->gr_mem[i];
#  354|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def18]
shadow-4.19.3/lib/list.c:64:25: warning[-Wanalyzer-malloc-leak]: leak of 'reallocarray(0, (long unsigned int)(i + 2), 8)'
shadow-4.19.3/lib/list.c:32:1: enter_function: entry to 'add_list'
shadow-4.19.3/lib/list.c:37:9: branch_true: following 'true' branch (when 'member' is non-NULL)...
shadow-4.19.3/lib/list.c:38:9: branch_true: ...to here
shadow-4.19.3/lib/list.c:38:9: branch_true: following 'true' branch (when 'list' is non-NULL)...
shadow-4.19.3/lib/list.c:38:9: branch_true: ...to here
shadow-4.19.3/lib/list.c:56:15: call_function: inlined call to 'mallocarray' from 'add_list'
shadow-4.19.3/lib/list.c:56:15: call_function: inlined call to 'exit_if_null_' from 'add_list'
shadow-4.19.3/lib/list.c:64:21: branch_false: following 'false' branch...
shadow-4.19.3/lib/list.c:68:18: branch_false: ...to here
shadow-4.19.3/lib/list.c:64:25: danger: 'reallocarray(0, (long unsigned int)(i + 2), 8)' leaks here; was allocated at [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#   62|   	 */
#   63|   
#   64|-> 	for (i = 0; list[i] != NULL; i++) {
#   65|   		tmp[i] = list[i];
#   66|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def19]
shadow-4.19.3/lib/list.c:150:24: warning[-Wanalyzer-malloc-leak]: leak of 'reallocarray(0, (long unsigned int)(i + 1), 8)'
shadow-4.19.3/lib/list.c:138:1: enter_function: entry to 'dup_list'
shadow-4.19.3/lib/list.c:143:9: branch_true: following 'true' branch (when 'list' is non-NULL)...
shadow-4.19.3/lib/list.c:143:9: branch_true: ...to here
shadow-4.19.3/lib/list.c:147:15: call_function: inlined call to 'mallocarray' from 'dup_list'
shadow-4.19.3/lib/list.c:147:15: call_function: inlined call to 'exit_if_null_' from 'dup_list'
shadow-4.19.3/lib/list.c:150:16: branch_true: following 'true' branch...
shadow-4.19.3/lib/list.c:151:26: branch_true: ...to here
shadow-4.19.3/lib/list.c:150:24: danger: 'reallocarray(0, (long unsigned int)(i + 1), 8)' leaks here; was allocated at [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
#  148|   
#  149|   	i = 0;
#  150|-> 	while (NULL != *list) {
#  151|   		tmp[i] = xstrdup (*list);
#  152|   		i++;

Error: COMPILER_WARNING (CWE-563): [#def20]
shadow-4.19.3/lib/commonio.c:30: included_from: Included from here.
shadow-4.19.3/lib/commonio.c: scope_hint: In function 'dec_lock_count'
shadow-4.19.3/lib/nscd.h:10:35: warning[-Wunused-value]: statement with no effect
#   10 | #define nscd_flush_cache(service) (0)
#      |                                   ^
shadow-4.19.3/lib/commonio.c:457:33: note: in expansion of macro 'nscd_flush_cache'
#  457 |                                 nscd_flush_cache ("passwd");
#      |                                 ^~~~~~~~~~~~~~~~
#    8|   extern int nscd_flush_cache (const char *service);
#    9|   #else
#   10|-> #define nscd_flush_cache(service) (0)
#   11|   #endif
#   12|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def21]
shadow-4.19.3/lib/readpassphrase.c:93:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open("/dev/tty", 2)'
shadow-4.19.3/lib/readpassphrase.c:63:12: branch_false: following 'false' branch (when 'bufsiz != 0')...
shadow-4.19.3/lib/readpassphrase.c:63:12: branch_false: ...to here
shadow-4.19.3/lib/readpassphrase.c:69:21: branch_true: following 'true' branch (when 'i != 65')...
shadow-4.19.3/lib/readpassphrase.c:70:17: branch_true: ...to here
shadow-4.19.3/lib/readpassphrase.c:78:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/readpassphrase.c:79:31: branch_false: ...to here
shadow-4.19.3/lib/readpassphrase.c:79:31: acquire_resource: opened here
shadow-4.19.3/lib/readpassphrase.c:78:13: branch_false: following 'false' branch...
shadow-4.19.3/lib/readpassphrase.c:93:12: branch_false: ...to here
shadow-4.19.3/lib/readpassphrase.c:93:12: danger: 'open("/dev/tty", 2)' leaks here; was opened at [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#   91|   	 * generate SIGTTOU, so do it *before* installing the signal handlers.
#   92|   	 */
#   93|-> 	if (input != STDIN_FILENO && tcgetattr(input, &oterm) == 0) {
#   94|   		term = oterm;
#   95|   		if (!(flags & RPP_ECHO_ON))

Error: COMPILER_WARNING (CWE-252): [#def22]
shadow-4.19.3/lib/readpassphrase.c: scope_hint: In function 'readpassphrase'
shadow-4.19.3/lib/readpassphrase.c:128:23: warning[-Wunused-result]: ignoring return value of 'write' declared with attribute 'warn_unused_result'
#  128 |                 (void)write(output, prompt, strlen(prompt));
#      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  126|   
#  127|   	if (!(flags & RPP_STDIN))
#  128|-> 		(void)write(output, prompt, strlen(prompt));
#  129|   	end = buf + bufsiz - 1;
#  130|   	p = buf;

Error: COMPILER_WARNING (CWE-252): [#def23]
shadow-4.19.3/lib/readpassphrase.c:147:23: warning[-Wunused-result]: ignoring return value of 'write' declared with attribute 'warn_unused_result'
#  147 |                 (void)write(output, "\n", 1);
#      |                       ^~~~~~~~~~~~~~~~~~~~~~
#  145|   	save_errno = errno;
#  146|   	if (!(term.c_lflag & ECHO))
#  147|-> 		(void)write(output, "\n", 1);
#  148|   
#  149|   	/* Restore old terminal settings and signals. */

Error: CPPCHECK_WARNING (CWE-476): [#def24]
shadow-4.19.3/lib/string/strcmp/streq.h:27: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: s1
#   25|   streq(const char *s1, const char *s2)
#   26|   {
#   27|-> 	return strcmp(s1, s2) == 0;
#   28|   }
#   29|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def25]
shadow-4.19.3/lib/string/strtok/stpsep.h:30:16: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(default_file, "r")’
shadow-4.19.3/src/useradd.c:2463:5: enter_function: entry to ‘main’
shadow-4.19.3/src/useradd.c:2498:23: call_function: inlined call to ‘exit_if_null_’ from ‘main’
shadow-4.19.3/src/useradd.c:2498:9: branch_false: ...to here
shadow-4.19.3/src/useradd.c:2510:9: call_function: calling ‘get_defaults’ from ‘main’
#   28|   	strsep(&s, delim);
#   29|   
#   30|-> 	return s;
#   31|   }
#   32|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def26]
shadow-4.19.3/lib/string/strtok/stpsep.h:30:16: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(default_file, "r")’
shadow-4.19.3/src/useradd.c:2463:5: enter_function: entry to ‘main’
shadow-4.19.3/src/useradd.c:2498:23: call_function: inlined call to ‘exit_if_null_’ from ‘main’
shadow-4.19.3/src/useradd.c:2498:9: branch_false: ...to here
shadow-4.19.3/src/useradd.c:2510:9: call_function: calling ‘get_defaults’ from ‘main’
#   28|   	strsep(&s, delim);
#   29|   
#   30|-> 	return s;
#   31|   }
#   32|   

Error: CPPCHECK_WARNING (CWE-457): [#def27]
shadow-4.19.3/lib/strtoday.c:38: error[uninitvar]: Uninitialized variable: d
#   36|   	 */
#   37|   	if (str2sl(&d, str) == 0)
#   38|-> 		return d;
#   39|   
#   40|   	d = get_date(str);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def28]
shadow-4.19.3/lib/sulog.c:59:13: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(getdef_str("SULOG_FILE"), "a+")'
shadow-4.19.3/lib/sulog.c:35:17: branch_false: following 'false' branch (when 'saved_locale' is NULL)...
shadow-4.19.3/lib/sulog.c:42:22: branch_false: ...to here
shadow-4.19.3/lib/sulog.c:43:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/sulog.c:47:18: branch_false: ...to here
shadow-4.19.3/lib/sulog.c:57:14: acquire_resource: opened here
shadow-4.19.3/lib/sulog.c:59:12: branch_true: following 'true' branch (when 'oldgid != 0')...
shadow-4.19.3/lib/sulog.c:59:31: branch_true: ...to here
shadow-4.19.3/lib/sulog.c:59:13: danger: 'fopen(getdef_str("SULOG_FILE"), "a+")' leaks here; was opened at [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#   57|   	fp = fopen (sulog_file, "a+");
#   58|   	(void) umask (oldmask);
#   59|-> 	if ((oldgid != 0) && (setgid (oldgid) != 0)) {
#   60|   		perror ("setgid");
#   61|   		SYSLOG ((LOG_ERR,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def29]
shadow-4.19.3/lib/sulog.c:59:13: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(getdef_str("SULOG_FILE"), "a+")'
shadow-4.19.3/lib/sulog.c:35:17: branch_false: following 'false' branch (when 'saved_locale' is NULL)...
shadow-4.19.3/lib/sulog.c:42:22: branch_false: ...to here
shadow-4.19.3/lib/sulog.c:43:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/sulog.c:47:18: branch_false: ...to here
shadow-4.19.3/lib/sulog.c:57:14: acquire_memory: allocated here
shadow-4.19.3/lib/sulog.c:59:12: branch_true: following 'true' branch (when 'oldgid != 0')...
shadow-4.19.3/lib/sulog.c:59:31: branch_true: ...to here
shadow-4.19.3/lib/sulog.c:59:13: danger: 'fopen(getdef_str("SULOG_FILE"), "a+")' leaks here; was allocated at [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
#   57|   	fp = fopen (sulog_file, "a+");
#   58|   	(void) umask (oldmask);
#   59|-> 	if ((oldgid != 0) && (setgid (oldgid) != 0)) {
#   60|   		perror ("setgid");
#   61|   		SYSLOG ((LOG_ERR,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def30]
shadow-4.19.3/lib/xgetXXbyYY.c:65:26: warning[-Wanalyzer-malloc-leak]: leak of 'reallocarray(0, 1, 32)'
shadow-4.19.3/lib/xgetXXbyYY.c:49:35: enter_function: entry to 'xgetgrnam'
shadow-4.19.3/lib/xgetXXbyYY.c:57:18: call_function: inlined call to 'mallocarray' from 'xgetgrnam'
shadow-4.19.3/lib/xgetXXbyYY.c:58:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/xgetXXbyYY.c:58:12: branch_false: ...to here
shadow-4.19.3/lib/xgetXXbyYY.c:65:26: danger: 'reallocarray(0, 1, 32)' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#   63|   		int status;
#   64|   		LOOKUP_TYPE *resbuf = NULL;
#   65|-> 		buffer = xrealloc_T(buffer, length, char);
#   66|   		status = REENTRANT_NAME(ARG_NAME, result, buffer,
#   67|   		                        length, &resbuf);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def31]
shadow-4.19.3/lib/xgetXXbyYY.c:65:26: warning[-Wanalyzer-malloc-leak]: leak of 'reallocarray(0, 1, 48)'
shadow-4.19.3/lib/xgetXXbyYY.c:49:35: enter_function: entry to 'xgetpwnam'
shadow-4.19.3/lib/xgetXXbyYY.c:57:18: call_function: inlined call to 'mallocarray' from 'xgetpwnam'
shadow-4.19.3/lib/xgetXXbyYY.c:58:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/xgetXXbyYY.c:58:12: branch_false: ...to here
shadow-4.19.3/lib/xgetXXbyYY.c:65:26: danger: 'reallocarray(0, 1, 48)' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#   63|   		int status;
#   64|   		LOOKUP_TYPE *resbuf = NULL;
#   65|-> 		buffer = xrealloc_T(buffer, length, char);
#   66|   		status = REENTRANT_NAME(ARG_NAME, result, buffer,
#   67|   		                        length, &resbuf);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def32]
shadow-4.19.3/lib/xgetXXbyYY.c:65:26: warning[-Wanalyzer-malloc-leak]: leak of 'reallocarray(0, 1, 72)'
shadow-4.19.3/lib/xgetXXbyYY.c:49:35: enter_function: entry to 'xgetspnam'
shadow-4.19.3/lib/xgetXXbyYY.c:57:18: call_function: inlined call to 'mallocarray' from 'xgetspnam'
shadow-4.19.3/lib/xgetXXbyYY.c:58:12: branch_false: following 'false' branch...
shadow-4.19.3/lib/xgetXXbyYY.c:58:12: branch_false: ...to here
shadow-4.19.3/lib/xgetXXbyYY.c:65:26: danger: 'reallocarray(0, 1, 72)' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#   63|   		int status;
#   64|   		LOOKUP_TYPE *resbuf = NULL;
#   65|-> 		buffer = xrealloc_T(buffer, length, char);
#   66|   		status = REENTRANT_NAME(ARG_NAME, result, buffer,
#   67|   		                        length, &resbuf);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def33]
shadow-4.19.3/libsubid/api.c:45:1: warning[-Wanalyzer-malloc-leak]: leak of 'progname'
shadow-4.19.3/libsubid/api.c:25:12: branch_true: following 'true' branch (when 'progname' is non-NULL)...
shadow-4.19.3/libsubid/api.c:26:28: branch_true: ...to here
shadow-4.19.3/libsubid/api.c:26:28: acquire_memory: allocated here
shadow-4.19.3/libsubid/api.c:27:20: branch_false: following 'false' branch (when 'progname' is non-NULL)...
shadow-4.19.3/libsubid/api.c:29:17: branch_false: ...to here
shadow-4.19.3/libsubid/api.c:45:1: danger: 'progname' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#   43|   	log_set_logfd(shadow_logfd);
#   44|   	return true;
#   45|-> }
#   46|   
#   47|   void subid_free(void *ptr)

Error: CPPCHECK_WARNING (CWE-457): [#def34]
shadow-4.19.3/src/check_subid_range.c:49: error[uninitvar]: Uninitialized variable: count
#   47|   		exit(1);
#   48|   	if (check_uids) {
#   49|-> 		if (have_sub_uids(owner, start, count))
#   50|   			exit(0);
#   51|   		exit(1);

Error: CPPCHECK_WARNING (CWE-908): [#def35]
shadow-4.19.3/src/faillog.c:678: error[useClosedFile]: Used file that is not opened.
#  676|   			         _("%s: Failed to write %s: %s\n"),
#  677|   			        Prog, FAILLOG_FILE, strerrno());
#  678|-> 			(void) fclose (fail);
#  679|   			errors = true;
#  680|   		}

Error: COMPILER_WARNING (CWE-252): [#def36]
shadow-4.19.3/src/gpasswd.c: scope_hint: In function ‘catch_signals’
shadow-4.19.3/src/gpasswd.c:168:24: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
#  168 |                 (void) write (STDOUT_FILENO, "\n", 1);
#      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  166|   
#  167|   	if (0 != killed) {
#  168|-> 		(void) write (STDOUT_FILENO, "\n", 1);
#  169|   		_exit (killed);
#  170|   	}

Error: COMPILER_WARNING: [#def37]
shadow-4.19.3/src/login.c: scope_hint: In function ‘main’
shadow-4.19.3/src/login.c:451:24: warning[-Wunused-but-set-variable=]: variable ‘subroot’ set but not used
#  451 |         bool           subroot = false;
#      |                        ^~~~~~~
#  449|   {
#  450|   	int            err;
#  451|-> 	bool           subroot = false;
#  452|   	char           **envp = environ;
#  453|   	char           *host = NULL;

Error: COMPILER_WARNING (CWE-252): [#def38]
shadow-4.19.3/src/login.c:718:25: warning[-Wunused-result]: ignoring return value of ‘audit_log_acct_message’ declared with attribute ‘warn_unused_result’
#  718 |                         audit_log_acct_message (audit_fd,
#      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  719 |                                                 AUDIT_USER_LOGIN,
#      |                                                 ~~~~~~~~~~~~~~~~~
#  720 |                                                 NULL,    /* Prog. name */
#      |                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~
#  721 |                                                 "login",
#      |                                                 ~~~~~~~~
#  722 |                                                 failent_user,
#      |                                                 ~~~~~~~~~~~~~
#  723 |                                                 AUDIT_NO_ID,
#      |                                                 ~~~~~~~~~~~~
#  724 |                                                 hostname,
#      |                                                 ~~~~~~~~~
#  725 |                                                 NULL,    /* addr */
#      |                                                 ~~~~~~~~~~~~~~~~~~~
#  726 |                                                 tty,
#      |                                                 ~~~~
#  727 |                                                 0);      /* result */
#      |                                                 ~~
#  716|   #ifdef WITH_AUDIT
#  717|   			audit_fd = audit_open ();
#  718|-> 			audit_log_acct_message (audit_fd,
#  719|   			                        AUDIT_USER_LOGIN,
#  720|   			                        NULL,    /* Prog. name */

Error: COMPILER_WARNING (CWE-252): [#def39]
shadow-4.19.3/src/login.c:1033:9: warning[-Wunused-result]: ignoring return value of ‘audit_log_acct_message’ declared with attribute ‘warn_unused_result’
# 1033 |         audit_log_acct_message (audit_fd,
#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1034 |                                 AUDIT_USER_LOGIN,
#      |                                 ~~~~~~~~~~~~~~~~~
# 1035 |                                 NULL,    /* Prog. name */
#      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~
# 1036 |                                 "login",
#      |                                 ~~~~~~~~
# 1037 |                                 username,
#      |                                 ~~~~~~~~~
# 1038 |                                 AUDIT_NO_ID,
#      |                                 ~~~~~~~~~~~~
# 1039 |                                 hostname,
#      |                                 ~~~~~~~~~
# 1040 |                                 NULL,    /* addr */
#      |                                 ~~~~~~~~~~~~~~~~~~~
# 1041 |                                 tty,
#      |                                 ~~~~
# 1042 |                                 1);      /* result */
#      |                                 ~~
# 1031|   #ifdef WITH_AUDIT
# 1032|   	audit_fd = audit_open ();
# 1033|-> 	audit_log_acct_message (audit_fd,
# 1034|   	                        AUDIT_USER_LOGIN,
# 1035|   	                        NULL,    /* Prog. name */

Error: COMPILER_WARNING (CWE-252): [#def40]
shadow-4.19.3/src/su.c: scope_hint: In function ‘su_failure’
shadow-4.19.3/src/su.c:216:9: warning[-Wunused-result]: ignoring return value of ‘audit_log_acct_message’ declared with attribute ‘warn_unused_result’
#  216 |         audit_log_acct_message (audit_fd,
#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  217 |                                 AUDIT_USER_ROLE_CHANGE,
#      |                                 ~~~~~~~~~~~~~~~~~~~~~~~
#  218 |                                 NULL,    /* Prog. name */
#      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~
#  219 |                                 "su",
#      |                                 ~~~~~
#  220 |                                 ('\0' != caller_name[0]) ? caller_name : "???",
#      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  221 |                                 AUDIT_NO_ID,
#      |                                 ~~~~~~~~~~~~
#  222 |                                 "localhost",
#      |                                 ~~~~~~~~~~~~
#  223 |                                 NULL,    /* addr */
#      |                                 ~~~~~~~~~~~~~~~~~~~
#  224 |                                 tty,
#      |                                 ~~~~
#  225 |                                 0);      /* result */
#      |                                 ~~
#  214|   #ifdef WITH_AUDIT
#  215|   	audit_fd = audit_open ();
#  216|-> 	audit_log_acct_message (audit_fd,
#  217|   				AUDIT_USER_ROLE_CHANGE,
#  218|   				NULL,    /* Prog. name */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def41]
shadow-4.19.3/src/su.c:258:23: warning[-Wanalyzer-malloc-leak]: leak of ‘reallocarray(0, n_args + 3, 8)’
shadow-4.19.3/src/su.c:236:13: enter_function: entry to ‘execve_shell’
shadow-4.19.3/src/su.c:244:12: branch_true: following ‘true’ branch...
shadow-4.19.3/src/su.c:244:12: branch_true: ...to here
shadow-4.19.3/src/su.c:254:25: call_function: inlined call to ‘mallocarray’ from ‘execve_shell’
shadow-4.19.3/src/su.c:254:25: call_function: inlined call to ‘exit_if_null_’ from ‘execve_shell’
shadow-4.19.3/src/su.c:255:17: branch_false: ...to here
shadow-4.19.3/src/su.c:257:28: call_function: inlined call to ‘exit_if_null_’ from ‘execve_shell’
shadow-4.19.3/src/su.c:257:17: branch_false: ...to here
shadow-4.19.3/src/su.c:258:23: danger: ‘reallocarray(0, n_args + 3, 8)’ leaks here; was allocated at [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
#  256|   		targs[1] = "-";
#  257|   		targs[2] = xstrdup (shellname);
#  258|-> 		targs[n_args+2] = NULL;
#  259|   		while (1 != n_args) {
#  260|   			targs[n_args+1] = args[n_args - 1];

Error: COMPILER_WARNING (CWE-252): [#def42]
shadow-4.19.3/src/su.c: scope_hint: In function ‘main’
shadow-4.19.3/src/su.c:1142:9: warning[-Wunused-result]: ignoring return value of ‘audit_log_acct_message’ declared with attribute ‘warn_unused_result’
# 1142 |         audit_log_acct_message (audit_fd,
#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1143 |                                 AUDIT_USER_ROLE_CHANGE,
#      |                                 ~~~~~~~~~~~~~~~~~~~~~~~
# 1144 |                                 NULL,    /* Prog. name */
#      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~
# 1145 |                                 "su",
#      |                                 ~~~~~
# 1146 |                                 (!streq(caller_name, "")) ? caller_name : "???",
#      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1147 |                                 AUDIT_NO_ID,
#      |                                 ~~~~~~~~~~~~
# 1148 |                                 "localhost",
#      |                                 ~~~~~~~~~~~~
# 1149 |                                 NULL,    /* addr */
#      |                                 ~~~~~~~~~~~~~~~~~~~
# 1150 |                                 caller_tty,
#      |                                 ~~~~~~~~~~~
# 1151 |                                 1);      /* result */
#      |                                 ~~
# 1140|   #ifdef WITH_AUDIT
# 1141|   	audit_fd = audit_open ();
# 1142|-> 	audit_log_acct_message (audit_fd,
# 1143|   				AUDIT_USER_ROLE_CHANGE,
# 1144|   				NULL,    /* Prog. name */

Error: GCC_ANALYZER_WARNING (CWE-775): [#def43]
shadow-4.19.3/src/sulogin.c:90:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(argv[1], 2)’
shadow-4.19.3/src/sulogin.c:85:12: branch_true: following ‘true’ branch (when ‘argc > 1’)...
shadow-4.19.3/src/sulogin.c:86:17: branch_true: ...to here
shadow-4.19.3/src/sulogin.c:90:21: acquire_resource: opened here
shadow-4.19.3/src/sulogin.c:90:20: danger: ‘open(argv[1], 2)’ leaks here; was opened at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#   88|   		close(2);
#   89|   
#   90|-> 		if (open(argv[1], O_RDWR) == -1)
#   91|   			exit(1);
#   92|   		dup(0);

Error: GCC_ANALYZER_WARNING (CWE-910): [#def44]
shadow-4.19.3/src/sulogin.c:92:17: warning[-Wanalyzer-fd-use-after-close]: ‘dup’ on closed file descriptor ‘0’
shadow-4.19.3/src/sulogin.c:85:12: branch_true: following ‘true’ branch (when ‘argc > 1’)...
shadow-4.19.3/src/sulogin.c:86:17: branch_true: ...to here
shadow-4.19.3/src/sulogin.c:86:17: release_resource: closed here
shadow-4.19.3/src/sulogin.c:90:20: branch_false: following ‘false’ branch...
shadow-4.19.3/src/sulogin.c:92:17: branch_false: ...to here
shadow-4.19.3/src/sulogin.c:92:17: danger: ‘dup’ on closed file descriptor ‘0’; ‘close’ was at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#   90|   		if (open(argv[1], O_RDWR) == -1)
#   91|   			exit(1);
#   92|-> 		dup(0);
#   93|   		dup(0);
#   94|   	}

Error: COMPILER_WARNING (CWE-252): [#def45]
shadow-4.19.3/src/sulogin.c: scope_hint: In function ‘main’
shadow-4.19.3/src/sulogin.c:92:17: warning[-Wunused-result]: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’
#   92 |                 dup(0);
#      |                 ^~~~~~
#   90|   		if (open(argv[1], O_RDWR) == -1)
#   91|   			exit(1);
#   92|-> 		dup(0);
#   93|   		dup(0);
#   94|   	}

Error: GCC_ANALYZER_WARNING (CWE-910): [#def46]
shadow-4.19.3/src/sulogin.c:93:17: warning[-Wanalyzer-fd-use-after-close]: ‘dup’ on closed file descriptor ‘0’
shadow-4.19.3/src/sulogin.c:85:12: branch_true: following ‘true’ branch (when ‘argc > 1’)...
shadow-4.19.3/src/sulogin.c:86:17: branch_true: ...to here
shadow-4.19.3/src/sulogin.c:86:17: release_resource: closed here
shadow-4.19.3/src/sulogin.c:90:20: branch_false: following ‘false’ branch...
shadow-4.19.3/src/sulogin.c:92:17: branch_false: ...to here
shadow-4.19.3/src/sulogin.c:93:17: danger: ‘dup’ on closed file descriptor ‘0’; ‘close’ was at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
#   91|   			exit(1);
#   92|   		dup(0);
#   93|-> 		dup(0);
#   94|   	}
#   95|   	if (access (PASSWD_FILE, F_OK) == -1) {	/* must be a password file! */

Error: COMPILER_WARNING (CWE-252): [#def47]
shadow-4.19.3/src/sulogin.c:93:17: warning[-Wunused-result]: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’
#   93 |                 dup(0);
#      |                 ^~~~~~
#   91|   			exit(1);
#   92|   		dup(0);
#   93|-> 		dup(0);
#   94|   	}
#   95|   	if (access (PASSWD_FILE, F_OK) == -1) {	/* must be a password file! */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def48]
shadow-4.19.3/src/useradd.c:356:17: warning[-Wanalyzer-malloc-leak]: leak of ‘default_file’
shadow-4.19.3/src/useradd.c:2463:5: enter_function: entry to ‘main’
shadow-4.19.3/src/useradd.c:2498:23: call_function: inlined call to ‘exit_if_null_’ from ‘main’
shadow-4.19.3/src/useradd.c:2498:9: branch_false: ...to here
shadow-4.19.3/src/useradd.c:2510:9: call_function: calling ‘get_defaults’ from ‘main’
#  354|   	fp = fopen (default_file, "r");
#  355|   	if (NULL == fp) {
#  356|-> 		goto getdef_err;
#  357|   	}
#  358|   

Error: GCC_ANALYZER_WARNING (CWE-590): [#def49]
shadow-4.19.3/src/useradd.c:496:17: warning[-Wanalyzer-free-of-non-heap]: ‘free’ of ‘default_file’ which points to memory not on the heap
shadow-4.19.3/src/useradd.c:2463:5: enter_function: entry to ‘main’
shadow-4.19.3/src/useradd.c:2498:23: call_function: inlined call to ‘exit_if_null_’ from ‘main’
shadow-4.19.3/src/useradd.c:2498:9: branch_false: ...to here
shadow-4.19.3/src/useradd.c:2510:9: call_function: calling ‘get_defaults’ from ‘main’
#  494|        getdef_err:
#  495|   	if (prefix[0]) {
#  496|-> 		free(default_file);
#  497|   	}
#  498|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def50]
shadow-4.19.3/src/useradd.c:498:1: warning[-Wanalyzer-malloc-leak]: leak of ‘default_file’
shadow-4.19.3/src/useradd.c:2463:5: enter_function: entry to ‘main’
shadow-4.19.3/src/useradd.c:2498:23: call_function: inlined call to ‘exit_if_null_’ from ‘main’
shadow-4.19.3/src/useradd.c:2498:9: branch_false: ...to here
shadow-4.19.3/src/useradd.c:2510:9: call_function: calling ‘get_defaults’ from ‘main’
#  496|   		free(default_file);
#  497|   	}
#  498|-> }
#  499|   
#  500|   /*

Error: COMPILER_WARNING (CWE-252): [#def51]
shadow-4.19.3/src/useradd.c: scope_hint: In function ‘create_home’
shadow-4.19.3/src/useradd.c:2325:16: warning[-Wunused-result]: ignoring return value of ‘chown’ declared with attribute ‘warn_unused_result’
# 2325 |         (void) chown(prefix_user_home, user_id, user_gid);
#      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 2323|   	free(bhome);
# 2324|   
# 2325|-> 	(void) chown(prefix_user_home, user_id, user_gid);
# 2326|   	mode = getdef_num("HOME_MODE",
# 2327|   			  0777 & ~getdef_num("UMASK", GETDEF_DEFAULT_UMASK));

Error: CPPCHECK_WARNING (CWE-457): [#def52]
shadow-4.19.3/src/usermod.c:341: error[uninitvar]: Uninitialized variable: pos
#  339|   	}
#  340|   
#  341|-> 	if ('-' != *pos++)
#  342|   		return result;
#  343|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def53]
shadow-4.19.3/src/vipw.c:278:12: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(file, "r")’
shadow-4.19.3/src/vipw.c:475:5: enter_function: entry to ‘main’
shadow-4.19.3/src/vipw.c:546:20: branch_false: following ‘false’ branch...
shadow-4.19.3/src/vipw.c:551:12: branch_false: ...to here
shadow-4.19.3/src/vipw.c:551:12: branch_true: following ‘true’ branch (when ‘do_vigr != 0’)...
shadow-4.19.3/src/vipw.c:553:20: branch_true: ...to here
shadow-4.19.3/src/vipw.c:553:20: branch_false: following ‘false’ branch (when ‘editshadow == 0’)...
shadow-4.19.3/src/vipw.c:561:25: branch_false: ...to here
shadow-4.19.3/src/vipw.c:561:25: call_function: calling ‘vipwedit’ from ‘main’
#  276|   		vipwexit (_("failed to gain privileges"), errno, 1);
#  277|   #endif				/* WITH_TCB */
#  278|-> 	if (create_backup_file (f, fileedit, &st1) != 0) {
#  279|   		vipwexit (_("Couldn't make backup"), errno, 1);
#  280|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def54]
shadow-4.19.3/src/vipw.c:278:12: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(file, "r")’
shadow-4.19.3/src/vipw.c:475:5: enter_function: entry to ‘main’
shadow-4.19.3/src/vipw.c:546:20: branch_false: following ‘false’ branch...
shadow-4.19.3/src/vipw.c:551:12: branch_false: ...to here
shadow-4.19.3/src/vipw.c:551:12: branch_true: following ‘true’ branch (when ‘do_vigr != 0’)...
shadow-4.19.3/src/vipw.c:553:20: branch_true: ...to here
shadow-4.19.3/src/vipw.c:553:20: branch_false: following ‘false’ branch (when ‘editshadow == 0’)...
shadow-4.19.3/src/vipw.c:561:25: branch_false: ...to here
shadow-4.19.3/src/vipw.c:561:25: call_function: calling ‘vipwedit’ from ‘main’
#  276|   		vipwexit (_("failed to gain privileges"), errno, 1);
#  277|   #endif				/* WITH_TCB */
#  278|-> 	if (create_backup_file (f, fileedit, &st1) != 0) {
#  279|   		vipwexit (_("Couldn't make backup"), errno, 1);
#  280|   	}

Error: COMPILER_WARNING (CWE-252): [#def55]
shadow-4.19.3/src/vipw.c: scope_hint: In function ‘vipwedit’
shadow-4.19.3/src/vipw.c:445:9: warning[-Wunused-result]: ignoring return value of ‘link’ declared with attribute ‘warn_unused_result’
#  445 |         link (file, filebackup);
#      |         ^~~~~~~~~~~~~~~~~~~~~~~
#  443|   #endif				/* WITH_TCB */
#  444|   	unlink (filebackup);
#  445|-> 	link (file, filebackup);
#  446|   	if (rename (to_rename, file) == -1) {
#  447|   		fprintf (stderr,

Scan Properties

analyzer-version-clippy1.95.0
analyzer-version-cppcheck2.20.0
analyzer-version-gcc16.0.1
analyzer-version-gcc-analyzer16.0.1
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-23.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20260420.180315.gd39a405.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-nameshadow-utils-4.19.3-2.fc45
store-results-to/tmp/tmp0lok2q8s/shadow-utils-4.19.3-2.fc45.tar.xz
time-created2026-04-28 19:56:55
time-finished2026-04-28 19:59:53
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'cppcheck,shellcheck,clippy,unicontrol,gcc' '-o' '/tmp/tmp0lok2q8s/shadow-utils-4.19.3-2.fc45.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmp0lok2q8s/shadow-utils-4.19.3-2.fc45.src.rpm'
tool-versioncsmock-3.8.5-1.el9