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/fakeroot-ng-0.18/process.h
Examining data/fakeroot-ng-0.18/credentials.cpp
Examining data/fakeroot-ng-0.18/chroot.h
Examining data/fakeroot-ng-0.18/file_lie.cpp
Examining data/fakeroot-ng-0.18/log.h
Examining data/fakeroot-ng-0.18/unique_fd.h
Examining data/fakeroot-ng-0.18/arch/linux/x86_64/platform.c
Examining data/fakeroot-ng-0.18/arch/linux/x86_64/platform_specific.h
Examining data/fakeroot-ng-0.18/arch/linux/i386/platform.c
Examining data/fakeroot-ng-0.18/arch/linux/i386/platform_specific.h
Examining data/fakeroot-ng-0.18/arch/linux/os.c
Examining data/fakeroot-ng-0.18/arch/linux/powerpc/platform.c
Examining data/fakeroot-ng-0.18/arch/linux/powerpc/platform_specific.h
Examining data/fakeroot-ng-0.18/arch/linux/os.h
Examining data/fakeroot-ng-0.18/arch/platform.h
Examining data/fakeroot-ng-0.18/process.cpp
Examining data/fakeroot-ng-0.18/refcount.h
Examining data/fakeroot-ng-0.18/ptrace.cpp
Examining data/fakeroot-ng-0.18/chroot.cpp
Examining data/fakeroot-ng-0.18/exceptions.h
Examining data/fakeroot-ng-0.18/log.cpp
Examining data/fakeroot-ng-0.18/tests/wait_test.cpp
Examining data/fakeroot-ng-0.18/tests/calc_defaults.cpp
Examining data/fakeroot-ng-0.18/tests/pwd.c
Examining data/fakeroot-ng-0.18/tests/getsiginfo.c
Examining data/fakeroot-ng-0.18/tests/exercise.c
Examining data/fakeroot-ng-0.18/tests/fbomb.cpp
Examining data/fakeroot-ng-0.18/tests/thread.c
Examining data/fakeroot-ng-0.18/daemon.h
Examining data/fakeroot-ng-0.18/parent.h
Examining data/fakeroot-ng-0.18/file_lie.h
Examining data/fakeroot-ng-0.18/syscalls.h
Examining data/fakeroot-ng-0.18/main.cpp
Examining data/fakeroot-ng-0.18/file.cpp
Examining data/fakeroot-ng-0.18/parent.cpp
Examining data/fakeroot-ng-0.18/daemon.cpp

FINAL RESULTS:

data/fakeroot-ng-0.18/arch/linux/os.c:232:17:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
    ssize_t ret=readlink( tmpbuff, buffer, buff_size>0 ? buff_size-1 : 0 );
data/fakeroot-ng-0.18/arch/linux/os.c:245:17:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
    ssize_t ret=readlink( tmpbuff, buffer, buff_size>0 ? buff_size-1 : 0 );
data/fakeroot-ng-0.18/chroot.cpp:138:26:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
        ssize_t link_len=readlink( combined_path.c_str(), buffer, sizeof(buffer) );
data/fakeroot-ng-0.18/parent.cpp:216:14:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
    DEF_SYS1(chown);
data/fakeroot-ng-0.18/parent.cpp:218:23:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
    DEF_SYS2(chown32, chown);
data/fakeroot-ng-0.18/parent.cpp:232:14:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
    DEF_SYS1(chmod);
data/fakeroot-ng-0.18/parent.cpp:267:14:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
    DEF_SYS2(readlink, generic_chroot_support_link_param1);
data/fakeroot-ng-0.18/syscalls.h:53:17:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
DECLARE_SYSFUNC(chmod);
data/fakeroot-ng-0.18/syscalls.h:55:17:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
DECLARE_SYSFUNC(chown);
data/fakeroot-ng-0.18/arch/linux/os.c:279:13:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function. If the scanf format is influenceable by an
  attacker, it's exploitable.
        if( sscanf( line, "PPid: "PID_F, &ret)!=1 )
data/fakeroot-ng-0.18/chroot.cpp:240:9:  [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).
        strcpy( state->mem->get_loc_c()+offset, newpath.c_str() );
data/fakeroot-ng-0.18/log.cpp:45:13:  [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(debug_log, format, params);
data/fakeroot-ng-0.18/main.cpp:38:5:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    printf(PACKAGE_NAME " version " PACKAGE_VERSION "\n");
data/fakeroot-ng-0.18/main.cpp:45:5:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    printf(PACKAGE_NAME " version " PACKAGE_VERSION "\n");
data/fakeroot-ng-0.18/main.cpp:141:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf( templt.get(), "%s/fakeroot-ng.XXXXXX", tmppath.c_str() );
data/fakeroot-ng-0.18/main.cpp:193:9:  [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(argv[0], argv);
data/fakeroot-ng-0.18/parent.cpp:280:14:  [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.
    DEF_SYS2(access, generic_chroot_support_param1);
data/fakeroot-ng-0.18/parent.cpp:924:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(filename, "%s/fakeroot-ng.XXXXXX", tmpdir);
data/fakeroot-ng-0.18/parent.cpp:957:5:  [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).
    strcpy(memory+ptlib_prepare_memory_len(), filename);
data/fakeroot-ng-0.18/tests/getsiginfo.c:140: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( argv[0], argv );
data/fakeroot-ng-0.18/daemon.cpp:340:26:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
    char *state_realpath=realpath(state_file_path, NULL);
data/fakeroot-ng-0.18/main.cpp:68:17:  [3] (buffer) getopt:
  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( (opt=getopt(argc, argv, "+p:l:dvfh" ))!=-1 ) {
data/fakeroot-ng-0.18/main.cpp:127:21:  [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.
    const char *tmp=getenv("FAKEROOT_TMPDIR");
data/fakeroot-ng-0.18/main.cpp:130:13:  [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.
        tmp=getenv("TMPDIR");
data/fakeroot-ng-0.18/main.cpp:284:22:  [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.
        argv[argc-1]=getenv("SHELL");
data/fakeroot-ng-0.18/parent.cpp:311:14:  [3] (misc) chroot:
  chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22).
  Make sure the program immediately chdir("/"), closes file descriptors, and
  drops root privileges, and that all necessary files (and no more!) are in
  the new root.
    DEF_SYS1(chroot);
data/fakeroot-ng-0.18/parent.cpp:916:24:  [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.
    const char *tmpdir=getenv("FAKEROOT_TMPDIR");
data/fakeroot-ng-0.18/parent.cpp:919:16:  [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.
        tmpdir=getenv("TMPDIR");
data/fakeroot-ng-0.18/syscalls.h:67:17:  [3] (misc) chroot:
  chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22).
  Make sure the program immediately chdir("/"), closes file descriptors, and
  drops root privileges, and that all necessary files (and no more!) are in
  the new root.
DECLARE_SYSFUNC(chroot);
data/fakeroot-ng-0.18/tests/pwd.c:15:5:  [3] (misc) chroot:
  chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22).
  Make sure the program immediately chdir("/"), closes file descriptors, and
  drops root privileges, and that all necessary files (and no more!) are in
  the new root.
    chroot( "dir");
data/fakeroot-ng-0.18/arch/linux/i386/platform.c:36:14:  [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 const char memory_image[mem_offset]=
data/fakeroot-ng-0.18/arch/linux/i386/platform_specific.h:24:18:  [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.
        unsigned char   __pad0[4];
data/fakeroot-ng-0.18/arch/linux/i386/platform_specific.h:36:18:  [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.
        unsigned char   __pad3[4];
data/fakeroot-ng-0.18/arch/linux/os.c:229: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 tmpbuff[20]; /* Leave enough chars for the digits */
data/fakeroot-ng-0.18/arch/linux/os.c:230:5:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
    sprintf(tmpbuff, "/proc/"PID_F"/cwd", pid );
data/fakeroot-ng-0.18/arch/linux/os.c:242: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 tmpbuff[40];
data/fakeroot-ng-0.18/arch/linux/os.c:243:5:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
    sprintf(tmpbuff, "/proc/"PID_F"/fd/%d", pid, fd );
data/fakeroot-ng-0.18/arch/linux/os.c:256: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 filename[100];
data/fakeroot-ng-0.18/arch/linux/os.c:257:5:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
    sprintf(filename, "/proc/"PID_F"/status", pid);
data/fakeroot-ng-0.18/arch/linux/os.c:259:21:  [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).
    FILE *stat_file=fopen(filename, "r");
data/fakeroot-ng-0.18/arch/linux/os.c:269:9:  [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 line[400];
data/fakeroot-ng-0.18/arch/linux/powerpc/platform.c:35:14:  [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 const char memory_image[mem_offset]=
data/fakeroot-ng-0.18/arch/linux/x86_64/platform.c:33:14:  [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 const char memory_image[mem_offset]=
data/fakeroot-ng-0.18/chroot.cpp:136:9:  [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 buffer[PATH_MAX+1];
data/fakeroot-ng-0.18/chroot.cpp:202: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 filename[PATH_MAX], wd[PATH_MAX];
data/fakeroot-ng-0.18/daemon.cpp:52:14:  [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.
    unsigned char _ancillary_buffer[CMSG_SPACE(sizeof(struct ucred))];
data/fakeroot-ng-0.18/daemon.cpp:272:28:  [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).
        FILE * new_state = fopen( tmp_path.c_str(), "wt" );
data/fakeroot-ng-0.18/daemon.cpp:331:29:  [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).
    unique_fd state_file( ::open( state_file_path, O_CREAT|O_RDWR, 0666 ), "State file open failed" );
data/fakeroot-ng-0.18/daemon.cpp:418: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).
        fd=open("/dev/null", O_RDWR);
data/fakeroot-ng-0.18/file.cpp:711:13:  [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 name[PATH_MAX];
data/fakeroot-ng-0.18/file.cpp:734:13:  [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 name[PATH_MAX];
data/fakeroot-ng-0.18/file.cpp:858:13:  [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 buffer[PATH_MAX];
data/fakeroot-ng-0.18/log.cpp:16:19:  [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).
        debug_log=fopen(file_name, "at");
data/fakeroot-ng-0.18/main.cpp:60: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 orig_wd[PATH_MAX];
data/fakeroot-ng-0.18/main.cpp:143:14:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
    int file=mkstemp( templt.get() );
data/fakeroot-ng-0.18/parent.cpp:174:14:  [2] (race) vfork:
  On some old systems, vfork() permits race conditions, and it's very
  difficult to use correctly (CWE-362). Use fork() instead.
    DEF_SYS1(vfork);
data/fakeroot-ng-0.18/parent.cpp:242: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).
    DEF_SYS1(open);
data/fakeroot-ng-0.18/parent.cpp:335:12:  [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[64];
data/fakeroot-ng-0.18/parent.cpp:357:9:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
        sprintf(buffer, "signal %d", signum);
data/fakeroot-ng-0.18/parent.cpp:365:12:  [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[64];
data/fakeroot-ng-0.18/parent.cpp:382:5:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
    sprintf(buffer, "Unknown state %d", state);
data/fakeroot-ng-0.18/parent.cpp:914: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 filename[PATH_MAX];
data/fakeroot-ng-0.18/parent.cpp:926:12:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
    int fd=mkstemp(filename);
data/fakeroot-ng-0.18/parent.cpp:954:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy( memory, ptlib_prepare_memory(), ptlib_prepare_memory_len() );
data/fakeroot-ng-0.18/process.cpp:140:13:  [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 cmd[PATH_MAX];
data/fakeroot-ng-0.18/syscalls.h:34:17:  [2] (race) vfork:
  On some old systems, vfork() permits race conditions, and it's very
  difficult to use correctly (CWE-362). Use fork() instead.
DECLARE_SYSFUNC(vfork);
data/fakeroot-ng-0.18/syscalls.h:36:17:  [2] (race) vfork:
  On some old systems, vfork() permits race conditions, and it's very
  difficult to use correctly (CWE-362). Use fork() instead.
DECLARE_SYSFUNC(vfork);
data/fakeroot-ng-0.18/syscalls.h:59:17:  [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).
DECLARE_SYSFUNC(open);
data/fakeroot-ng-0.18/tests/exercise.c:47:13:  [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).
    dirfd = open(".", O_RDONLY|O_DIRECTORY);
data/fakeroot-ng-0.18/tests/fbomb.cpp:22:16:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
    int target=atoi(argv[1]);
data/fakeroot-ng-0.18/tests/getsiginfo.c:59:20:  [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[50];
data/fakeroot-ng-0.18/tests/getsiginfo.c:60:13:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
            sprintf( buffer, "signal %d", sig );
data/fakeroot-ng-0.18/tests/pwd.c:9: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 buffer[PATH_MAX];
data/fakeroot-ng-0.18/arch/linux/os.c:222:16:  [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).
    size_t len=strlen(local_ptr)+1;
data/fakeroot-ng-0.18/arch/linux/os.c:273:18:  [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( line[strlen(line)-1]!='\n' ) {
data/fakeroot-ng-0.18/arch/linux/os.c:275:24:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            while( (ch=getc( stat_file ))!=EOF && ch!='\n' )
data/fakeroot-ng-0.18/chroot.cpp:205:5:  [1] (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). Risk is low because the source is a constant character.
    strcpy( wd, "/" );
data/fakeroot-ng-0.18/file.cpp:871:21:  [1] (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). Risk is low because the source is a constant character.
                    strcpy( buffer, "/" );
data/fakeroot-ng-0.18/file.cpp:879:24:  [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).
            size_t len=strlen(ptr);
data/fakeroot-ng-0.18/main.cpp:242:5:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    read( pipes[0], &buffer, sizeof(buffer) );
data/fakeroot-ng-0.18/main.cpp:247:17:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    if( (numret=read( child_socket, &buffer, sizeof(int) ))<(int)sizeof(int) ) {
data/fakeroot-ng-0.18/parent.cpp:921:25:  [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( tmpdir==NULL || strlen(tmpdir)>=PATH_MAX-sizeof("/fakeroot-ng.XXXXXX") )
data/fakeroot-ng-0.18/tests/calc_defaults.cpp:39:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        if( read( pfd[0], &buffer, 1 )!=1 ) {
data/fakeroot-ng-0.18/tests/exercise.c:21:5:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
    umask(0022);

ANALYSIS SUMMARY:

Hits = 84
Lines analyzed = 8708 in approximately 0.25 seconds (35380 lines/second)
Physical Source Lines of Code (SLOC) = 6176
Hits@level = [0]  49 [1]  11 [2]  43 [3]  10 [4]  11 [5]   9
Hits@level+ = [0+] 133 [1+]  84 [2+]  73 [3+]  30 [4+]  20 [5+]   9
Hits/KSLOC@level+ = [0+] 21.535 [1+] 13.601 [2+] 11.8199 [3+] 4.85751 [4+] 3.23834 [5+] 1.45725
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.