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/daemonize-1.7.8/basename.c
Examining data/daemonize-1.7.8/daemon.c
Examining data/daemonize-1.7.8/daemonize.c
Examining data/daemonize-1.7.8/flock.c
Examining data/daemonize-1.7.8/flock.h
Examining data/daemonize-1.7.8/getopt.c
Examining data/daemonize-1.7.8/setenv.c
Examining data/daemonize-1.7.8/strerror.c
Examining data/daemonize-1.7.8/testdaemon.c
Examining data/daemonize-1.7.8/version.h
Examining data/daemonize-1.7.8/config.h

FINAL RESULTS:

data/daemonize-1.7.8/daemonize.c:290:13:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
        if (chown(pid_file, pw->pw_uid, pw->pw_gid) == -1)
data/daemonize-1.7.8/daemonize.c:65:5:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    vfprintf(stderr, format, ap);
data/daemonize-1.7.8/daemonize.c:85:9:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
        vfprintf(stdout, format, ap);
data/daemonize-1.7.8/daemonize.c:122:9:  [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(stderr, USAGE[i], prog);
data/daemonize-1.7.8/daemonize.c:436:9:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
    if (access(cmd[0], X_OK) == -1)
data/daemonize-1.7.8/daemonize.c:527:5:  [4] (shell) execvp:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
    execvp(cmd[0], cmd);
data/daemonize-1.7.8/testdaemon.c:46:5:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    vfprintf (fp, format, ap);
data/daemonize-1.7.8/daemonize.c:521: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("IFS") == NULL)
data/daemonize-1.7.8/daemonize.c:524: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("PATH") == NULL)
data/daemonize-1.7.8/config.h:60:8:  [2] (race) vfork:
  On some old systems, vfork() permits race conditions, and it's very
  difficult to use correctly (CWE-362). Use fork() instead.
#undef vfork
data/daemonize-1.7.8/config.h:61:9:  [2] (race) vfork:
  On some old systems, vfork() permits race conditions, and it's very
  difficult to use correctly (CWE-362). Use fork() instead.
#define vfork fork
data/daemonize-1.7.8/daemon.c:55:8:  [2] (misc) open:
  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 (open("/dev/null", O_RDWR) != 0)
data/daemonize-1.7.8/daemonize.c:341:12:  [2] (misc) open:
  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).
    return open(path, flags, 0666);
data/daemonize-1.7.8/daemonize.c:353:24:  [2] (misc) open:
  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 ((null_fd = open("/dev/null", O_WRONLY)) == -1)
data/daemonize-1.7.8/daemonize.c:451:18:  [2] (misc) open:
  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).
        lockFD = open(lock_file, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
data/daemonize-1.7.8/daemonize.c:466:14:  [2] (misc) open:
  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).
        fd = open(pid_file, O_CREAT | O_WRONLY,
data/daemonize-1.7.8/daemonize.c:507:22:  [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 ( (fPid = fopen (pid_file, "w")) == NULL )
data/daemonize-1.7.8/getopt.c:49:2:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
	char errbuf[2];\
data/daemonize-1.7.8/strerror.c:25:11:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
   static char buffer [MAX_INT_DIGITS + 1];
data/daemonize-1.7.8/testdaemon.c:27:8:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static char buf[64];
data/daemonize-1.7.8/testdaemon.c:60:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char cwdbuf[256];
data/daemonize-1.7.8/daemon.c:114:9:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
        umask(0);
data/daemonize-1.7.8/daemonize.c:146:21:  [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).
    int val_len  = (strlen(envvar) - name_len) - 1;
data/daemonize-1.7.8/daemonize.c:152:12:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
    (void) strncat(name, envvar, name_len);
data/daemonize-1.7.8/daemonize.c:154:12:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
    (void) strncat(value, eq, val_len);
data/daemonize-1.7.8/getopt.c:51:37:  [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).
	(void) write(2, argv[0], (unsigned)strlen(argv[0]));\
data/daemonize-1.7.8/getopt.c:52:31:  [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).
	(void) write(2, s, (unsigned)strlen(s));\
data/daemonize-1.7.8/setenv.c:28:28:  [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).
    if ((name == NULL) || (strlen(name) == 0) || (strchr(name, '=') != NULL))
data/daemonize-1.7.8/setenv.c:36:37:  [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).
        char *buf = (char *) malloc(strlen(name) + strlen(value) + 2);
data/daemonize-1.7.8/setenv.c:36:52:  [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).
        char *buf = (char *) malloc(strlen(name) + strlen(value) + 2);
data/daemonize-1.7.8/setenv.c:37:9:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
        strncat(buf, name, strlen(name));
data/daemonize-1.7.8/setenv.c:37:28:  [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).
        strncat(buf, name, strlen(name));
data/daemonize-1.7.8/setenv.c:38:9:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings. Risk is low because the source is a
  constant character.
        strncat(buf, "=", 1);
data/daemonize-1.7.8/setenv.c:39:9:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
        strncat(buf, value, strlen(value));
data/daemonize-1.7.8/setenv.c:39:29:  [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).
        strncat(buf, value, strlen(value));

ANALYSIS SUMMARY:

Hits = 35
Lines analyzed = 1166 in approximately 0.08 seconds (14081 lines/second)
Physical Source Lines of Code (SLOC) = 638
Hits@level = [0]   4 [1]  14 [2]  12 [3]   2 [4]   6 [5]   1
Hits@level+ = [0+]  39 [1+]  35 [2+]  21 [3+]   9 [4+]   7 [5+]   1
Hits/KSLOC@level+ = [0+] 61.1285 [1+] 54.8589 [2+] 32.9154 [3+] 14.1066 [4+] 10.9718 [5+] 1.5674
Dot directories skipped = 1 (--followdotdir overrides)
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.