Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler.
Number of rules (primarily dangerous function names) in C/C++ ruleset: 223
Examining data/base-passwd-3.5.48/update-passwd.c

FINAL RESULTS:

data/base-passwd-3.5.48/update-passwd.c:1172:9:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
    if (chmod(target, st.st_mode)!=0) {
data/base-passwd-3.5.48/update-passwd.c:1191:7:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
		    chown (target, st.st_uid, st.st_gid) != 0) {
data/base-passwd-3.5.48/update-passwd.c:186:12:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
    return strcpy(xmalloc(strlen(string) + 1), string);
data/base-passwd-3.5.48/update-passwd.c:1100:6:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	    fprintf(f, ((idx==0) ? "%s" : ",%s"), g->gr_mem[idx]);
data/base-passwd-3.5.48/update-passwd.c:1382:18:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((optc=getopt_long(argc, argv, "g:p:G:P:S:snvLhV", options, &opt_index))!=-1)
data/base-passwd-3.5.48/update-passwd.c:1430:9:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
    if (getenv("DEBIAN_HAS_FRONTEND")!=NULL && !opt_dryrun) {
data/base-passwd-3.5.48/update-passwd.c:426:16:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    if ((input=fopen(file, "r"))==NULL) {
data/base-passwd-3.5.48/update-passwd.c:465:16:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    if ((input=fopen(file, "r"))==NULL) {
data/base-passwd-3.5.48/update-passwd.c:504:16:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    if ((input=fopen(file, "r"))==NULL) {
data/base-passwd-3.5.48/update-passwd.c:1042:17:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    if ((output=fopen(file, "wt"))==NULL) {
data/base-passwd-3.5.48/update-passwd.c:1071:17:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    if ((output=fopen(file, "wt"))==NULL) {
data/base-passwd-3.5.48/update-passwd.c:1113:17:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    if ((output=fopen(file, "wt"))==NULL) {
data/base-passwd-3.5.48/update-passwd.c:186:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    return strcpy(xmalloc(strlen(string) + 1), string);
data/base-passwd-3.5.48/update-passwd.c:1472:5:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
    umask(0077);

ANALYSIS SUMMARY:

Hits = 14
Lines analyzed = 1493 in approximately 0.05 seconds (29608 lines/second)
Physical Source Lines of Code (SLOC) = 1102
Hits@level = [0]  62 [1]   2 [2]   6 [3]   2 [4]   2 [5]   2
Hits@level+ = [0+]  76 [1+]  14 [2+]  12 [3+]   6 [4+]   4 [5+]   2
Hits/KSLOC@level+ = [0+] 68.9655 [1+] 12.7042 [2+] 10.8893 [3+] 5.44465 [4+] 3.62976 [5+] 1.81488
Minimum risk level = 1
Not every hit is necessarily a security vulnerability.
There may be other security vulnerabilities; review your code!
See 'Secure Programming HOWTO'
(https://dwheeler.com/secure-programs) for more information.