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/android-platform-build-8.1.0+r23/tools/acp/acp.c
Examining data/android-platform-build-8.1.0+r23/tools/atree/atree.cpp
Examining data/android-platform-build-8.1.0+r23/tools/atree/files.cpp
Examining data/android-platform-build-8.1.0+r23/tools/atree/files.h
Examining data/android-platform-build-8.1.0+r23/tools/atree/fs.cpp
Examining data/android-platform-build-8.1.0+r23/tools/atree/fs.h
Examining data/android-platform-build-8.1.0+r23/tools/atree/options.h
Examining data/android-platform-build-8.1.0+r23/tools/fs_config/android_filesystem_config_test_data.h
Examining data/android-platform-build-8.1.0+r23/tools/fs_config/default/android_filesystem_config.h
Examining data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config.c
Examining data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_generate.c
Examining data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_test.cpp
Examining data/android-platform-build-8.1.0+r23/tools/fs_get_stats/fs_get_stats.c
Examining data/android-platform-build-8.1.0+r23/tools/ijar/classfile.cc
Examining data/android-platform-build-8.1.0+r23/tools/ijar/common.h
Examining data/android-platform-build-8.1.0+r23/tools/ijar/ijar.cc
Examining data/android-platform-build-8.1.0+r23/tools/ijar/zip.cc
Examining data/android-platform-build-8.1.0+r23/tools/ijar/zip.h
Examining data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc
Examining data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c
Examining data/android-platform-build-8.1.0+r23/tools/libhost/include/host/CopyFile.h
Examining data/android-platform-build-8.1.0+r23/tools/makeparallel/makeparallel.cpp
Examining data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp
Examining data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.h
Examining data/android-platform-build-8.1.0+r23/tools/zipalign/ZipFile.h
Examining data/android-platform-build-8.1.0+r23/tools/zipalign/ZipFile.cpp
Examining data/android-platform-build-8.1.0+r23/tools/zipalign/ZipAlign.cpp
Examining data/android-platform-build-8.1.0+r23/tools/ziptime/ZipEntry.cpp
Examining data/android-platform-build-8.1.0+r23/tools/ziptime/ZipEntry.h
Examining data/android-platform-build-8.1.0+r23/tools/ziptime/ZipFile.cpp
Examining data/android-platform-build-8.1.0+r23/tools/ziptime/ZipFile.h
Examining data/android-platform-build-8.1.0+r23/tools/ziptime/ZipTime.cpp

FINAL RESULTS:

data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:183:13:  [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(dst, pSrcStat->st_mode & ~(S_IFMT)) != 0) {
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:191: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(dst, pSrcStat->st_uid, pSrcStat->st_gid) != 0) {
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:269:10:  [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(dst, S_IWRITE|S_IREAD) == 0 && unlink(dst) == 0)
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:394:15:  [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.
    nameLen = readlink(src, linkBuf, sizeof(linkBuf)-1);
data/android-platform-build-8.1.0+r23/tools/acp/acp.c:28:18:  [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.
# define DBUG(x) printf x
data/android-platform-build-8.1.0+r23/tools/atree/atree.cpp:87:9:  [4] (format) vprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
        vprintf(format, ap);
data/android-platform-build-8.1.0+r23/tools/atree/fs.cpp:175:20:  [4] (shell) execlp:
  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.
            return execlp(strip_cmd, strip_cmd, path.c_str(), (char *)NULL);
data/android-platform-build-8.1.0+r23/tools/atree/fs.cpp:200:23:  [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.
            int ret = execvp(args[0], (char* const*)args);
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config.c:155:7:  [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(" capabilities=0x%" PRIx64, capabilities);
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_generate.c:187:27:  [4] (shell) system:
  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.
        static const char system[] = "system/";
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_generate.c:203:35:  [4] (shell) system:
  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.
            (!strncmp(pc->prefix, system, strlen(system)) &&
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_generate.c:203:50:  [4] (shell) system:
  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.
            (!strncmp(pc->prefix, system, strlen(system)) &&
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_generate.c:204:43:  [4] (shell) system:
  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.
             !strncmp(pc->prefix + strlen(system), arg, plen) &&
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_generate.c:205:33:  [4] (shell) system:
  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.
             (pc->prefix[strlen(system) + plen] == '/'))) {
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_test.cpp:39:14:  [4] (shell) popen:
  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.
  FILE* fp = popen(command.c_str(), "r");
data/android-platform-build-8.1.0+r23/tools/fs_get_stats/fs_get_stats.c:12:3:  [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, "%s:%d: ERROR: " fmt,  \
data/android-platform-build-8.1.0+r23/tools/fs_get_stats/fs_get_stats.c:18:7:  [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.
	do { fprintf(stderr, "DEBUG: " fmt, ##args); } while(0)
data/android-platform-build-8.1.0+r23/tools/ijar/ijar.cc:166:7:  [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(filename_out_buf, filename_in);
data/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:161:5:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
    vsnprintf(errmsg, 4*PATH_MAX, fmt, ap);
data/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:273:5:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
    vsnprintf(errmsg, 4*PATH_MAX, fmt, ap);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:43:18:  [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.
# define DBUG(x) printf x
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:306: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(srcRsrcName, src);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:310: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(dstRsrcName, dst);
data/android-platform-build-8.1.0+r23/tools/makeparallel/makeparallel.cpp:397:15:  [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.
    int ret = execvp(path, args.data());
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipAlign.cpp:144:19:  [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 (!force && access(outFileName, F_OK) == 0) {
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:129: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((char*) mCDE.mFileName, fileName);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:135: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((char*) mCDE.mFileComment, comment);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:158: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((char*) mCDE.mFileName, (char*)pEntry->mCDE.mFileName);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:164: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((char*) mCDE.mFileComment, (char*)pEntry->mCDE.mFileComment);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:252: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((char*) mLFH.mFileName, (const char*) mCDE.mFileName);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipFile.cpp:83:23:  [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.
        newArchive = (access(zipFileName, F_OK) != 0);
data/android-platform-build-8.1.0+r23/tools/ziptime/ZipEntry.cpp:30:18:  [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.
#define LOG(...) fprintf(stderr, __VA_ARGS__)
data/android-platform-build-8.1.0+r23/tools/ziptime/ZipFile.cpp:31:18:  [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.
#define LOG(...) fprintf(stderr, __VA_ARGS__)
data/android-platform-build-8.1.0+r23/tools/acp/acp.c:184:14:  [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.
        ic = getopt(argc, argv, "defprtuv");
data/android-platform-build-8.1.0+r23/tools/atree/atree.cpp:15: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.
bool g_debug = getenv("ATREE_DEBUG") != NULL;
data/android-platform-build-8.1.0+r23/tools/atree/atree.cpp:119:19:  [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.
        int opt = getopt(argc, argv, "f:I:o:hlm:v:d");
data/android-platform-build-8.1.0+r23/tools/atree/fs.cpp:149:29:  [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* strip_cmd = getenv("ATREE_STRIP");
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config.c:80:16:  [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, "CS:D:")) != -1) {
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_generate.c:82: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, optstring)) != -1) {
data/android-platform-build-8.1.0+r23/tools/makeparallel/makeparallel.cpp:64:31:  [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* makeflags_env = getenv("MAKEFLAGS");
data/android-platform-build-8.1.0+r23/tools/makeparallel/makeparallel.cpp:122:13:  [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.
    int c = getopt_long(getopt_argv.size(), getopt_argv.data(), "kj",
data/android-platform-build-8.1.0+r23/tools/acp/acp.c:63: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(stripDest, argv[argc-1], stripDestLen+1);
data/android-platform-build-8.1.0+r23/tools/acp/acp.c:124:9:  [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(src, argv[i], srcLen+1);
data/android-platform-build-8.1.0+r23/tools/acp/acp.c:143:13:  [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(dst, stripDest, stripDestLen);
data/android-platform-build-8.1.0+r23/tools/acp/acp.c:145:13:  [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(dst + stripDestLen+1, srcName, srcNameLen+1);
data/android-platform-build-8.1.0+r23/tools/atree/atree.cpp:341: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).
        FILE *f = fopen(g_dependency.c_str(), "w");
data/android-platform-build-8.1.0+r23/tools/atree/files.cpp:190:9:  [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).
    f = fopen(filename.c_str(), "r");
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config.c:74:3:  [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[1024];
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_generate.c:130:12:  [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).
      fp = fopen(optarg, "wb");
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_generate.c:166: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[512];
data/android-platform-build-8.1.0+r23/tools/ijar/common.h:94:3:  [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(p, src, n);
data/android-platform-build-8.1.0+r23/tools/ijar/ijar.cc:162:3:  [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_out_buf[PATH_MAX];
data/android-platform-build-8.1.0+r23/tools/ijar/ijar.cc:167:7:  [2] (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 string.
      strcpy(filename_out_buf + len - 4, "-interface.jar");
data/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:151:3:  [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/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:156:3:  [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 errmsg[4*PATH_MAX];
data/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:268:3:  [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 errmsg[4*PATH_MAX];
data/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:577: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(reinterpret_cast<void*>(filename), p, len);
data/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:597:3:  [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/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:707:15:  [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).
  int fd_in = open(filename, O_RDONLY);
data/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:846:3:  [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(entry->file_name, filename, file_name_length_);
data/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:902: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(buf, outbuf, length);
data/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:982:16:  [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).
  int fd_out = open(zip_file, O_CREAT|O_RDWR|O_TRUNC, 0644);
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:92:3:  [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 path_[PATH_MAX];
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:127: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 path[PATH_MAX];
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:132: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(path, O_CREAT | O_WRONLY, perm);
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:160:3:  [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 output_root[PATH_MAX];
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:195: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 path[PATH_MAX];
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:226:16:  [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).
      int fd = open(files[i], O_RDONLY);
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:238:7:  [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(buffer, data, statst.st_size);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:118: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 buf[8192];
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:243: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).
    srcFd = open(src, O_RDONLY | O_BINARY, 0);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:251: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).
    dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:281:21:  [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).
            dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:307:9:  [2] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused). Risk is low because the
  source is a constant string.
        strcat(srcRsrcName, "/rsrc");
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:311:9:  [2] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused). Risk is low because the
  source is a constant string.
        strcat(dstRsrcName, "/rsrc");
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:316:21:  [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).
            srcFd = open(srcRsrcName, O_RDONLY);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:317:21:  [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).
            dstFd = open(dstRsrcName, O_TRUNC | O_WRONLY, 0);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:360: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 linkBuf[PATH_MAX+1];
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:507:9:  [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(srcFile, src, srcLen);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:509:9:  [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(srcFile + srcLen+1, ent->d_name, nameLen +1);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:512:9:  [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(dstFile, dst, dstLen);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:514:9:  [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(dstFile + dstLen+1, ent->d_name, nameLen +1);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipAlign.cpp:149: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).
    if (zin.open(inFileName, ZipFile::kOpenReadOnly) != NO_ERROR) {
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipAlign.cpp:153: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).
    if (zout.open(outFileName,
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipAlign.cpp:181: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).
    if (zipFile.open(fileName, ZipFile::kOpenReadOnly) != NO_ERROR) {
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:171:9:  [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(mCDE.mExtraField, pEntry->mCDE.mExtraField,
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:188:9:  [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(mLFH.mExtraField, pEntry->mLFH.mExtraField,
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:216:9:  [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(newExtra, mLFH.mExtraField, mLFH.mExtraFieldLength);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipFile.cpp:64:19:  [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).
status_t ZipFile::open(const char* zipFileName, int flags)
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipFile.cpp:101:14:  [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).
    mZipFp = fopen(zipFileName, openflags);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipFile.cpp:388: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).
        inputFp = fopen(fileName, FILE_OPEN_RO);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipFile.cpp:1306:9:  [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(mComment, buf + kEOCDLen, mCommentLen);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipFile.h:66: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).
    status_t open(const char* zipFileName, int flags);
data/android-platform-build-8.1.0+r23/tools/ziptime/ZipFile.cpp:41:14:  [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).
    mZipFp = fopen(zipFileName, "r+b");
data/android-platform-build-8.1.0+r23/tools/acp/acp.c:61:20:  [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).
    stripDestLen = strlen(argv[argc-1]);
data/android-platform-build-8.1.0+r23/tools/acp/acp.c:122: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).
        srcLen = strlen(argv[i]);
data/android-platform-build-8.1.0+r23/tools/acp/acp.c:140:30:  [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 srcNameLen = strlen(srcName);
data/android-platform-build-8.1.0+r23/tools/atree/atree.cpp:61:19:  [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).
    fwrite(USAGE, strlen(USAGE), 1, stderr);
data/android-platform-build-8.1.0+r23/tools/atree/files.cpp:246:19:  [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 len = strlen(p);
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config.c:141:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      strncpy(full_name + 1, buffer, full_name_size - 1);
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_generate.c:196: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).
        plen = strlen(arg);
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_generate.c:203:43:  [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).
            (!strncmp(pc->prefix, system, strlen(system)) &&
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_generate.c:204:36:  [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).
             !strncmp(pc->prefix + strlen(system), arg, plen) &&
data/android-platform-build-8.1.0+r23/tools/fs_config/fs_config_generate.c:205:26:  [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).
             (pc->prefix[strlen(system) + plen] == '/'))) {
data/android-platform-build-8.1.0+r23/tools/ijar/ijar.cc:39:39:  [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).
const size_t CLASS_EXTENSION_LENGTH = strlen(CLASS_EXTENSION);
data/android-platform-build-8.1.0+r23/tools/ijar/ijar.cc:67:20:  [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).
  ssize_t offset = strlen(filename) - CLASS_EXTENSION_LENGTH;
data/android-platform-build-8.1.0+r23/tools/ijar/ijar.cc:164: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).
    size_t len = strlen(filename_in);
data/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:764: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).
  size_t file_name_length = strlen(filename);
data/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:840: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).
  off_t file_name_length_ = strlen(filename);
data/android-platform-build-8.1.0+r23/tools/ijar/zip.cc:1027:13:  [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 += strlen(files[i]) * 2;
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:74:14:  [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 len1 = strlen(path1);
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:76:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(out, path1, size - 1);
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:84:5:  [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(out, path2, size - 1 - l);
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:94:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(path_, path, PATH_MAX);
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:120:22:  [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).
    isdir = filename[strlen(filename)-1] == '/';
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:153:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(output, pointer, output_size);
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:206:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      strncpy(path, files[i], PATH_MAX);
data/android-platform-build-8.1.0+r23/tools/ijar/zip_main.cc:208:20:  [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(path);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:125:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        readCount = read(srcFd, buf, sizeof(buf));
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:305:30:  [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).
        srcRsrcName = malloc(strlen(src) + 5 + 1);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:309:30:  [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).
        dstRsrcName = malloc(strlen(dst) + 5 + 1);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:502:19:  [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).
        nameLen = strlen(ent->d_name);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:503: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).
        srcLen = strlen(src);
data/android-platform-build-8.1.0+r23/tools/libhost/CopyFile.c:504: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).
        dstLen = strlen(dst);
data/android-platform-build-8.1.0+r23/tools/makeparallel/makeparallel.cpp:210:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  int read_ret = read(dup_fd, &buf, 1);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:50:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    result = mCDE.read(fp);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:66:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    result = mLFH.read(fp);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:122: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).
    mCDE.mFileNameLength = strlen(fileName);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:124:35:  [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).
        mCDE.mFileCommentLength = strlen(comment);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:404:37:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
status_t ZipEntry::LocalFileHeader::read(FILE* fp)
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.cpp:538:37:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
status_t ZipEntry::CentralDirEntry::read(FILE* fp)
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.h:242:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        status_t read(FILE* fp);
data/android-platform-build-8.1.0+r23/tools/zipalign/ZipEntry.h:300:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        status_t read(FILE* fp);

ANALYSIS SUMMARY:

Hits = 133
Lines analyzed = 10396 in approximately 0.49 seconds (21263 lines/second)
Physical Source Lines of Code (SLOC) = 7055
Hits@level = [0] 199 [1]  39 [2]  53 [3]   8 [4]  29 [5]   4
Hits@level+ = [0+] 332 [1+] 133 [2+]  94 [3+]  41 [4+]  33 [5+]   4
Hits/KSLOC@level+ = [0+] 47.0588 [1+] 18.8519 [2+] 13.3239 [3+] 5.81148 [4+] 4.67753 [5+] 0.566974
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.