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/rkflashtool-0~20160324/rkcrc.c
Examining data/rkflashtool-0~20160324/rkcrc.h
Examining data/rkflashtool-0~20160324/rkflashtool.c
Examining data/rkflashtool-0~20160324/rkflashtool.h
Examining data/rkflashtool-0~20160324/rkunpack.c
Examining data/rkflashtool-0~20160324/version.h

FINAL RESULTS:

data/rkflashtool-0~20160324/rkcrc.c:52: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, f, ap);
data/rkflashtool-0~20160324/rkflashtool.c:156: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, f, ap);
data/rkflashtool-0~20160324/rkunpack.c:62: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, f, ap);
data/rkflashtool-0~20160324/rkcrc.c:68:18:  [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 ((ch = getopt(argc, argv, "kp")) != -1) {
data/rkflashtool-0~20160324/rkflashtool.c:191:18:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    long int r = random();
data/rkflashtool-0~20160324/rkflashtool.c:205:18:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    long int r = random();
data/rkflashtool-0~20160324/rkflashtool.c:218:18:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    long int r = random();
data/rkflashtool-0~20160324/rkcrc.c:44: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 headers[2][4] = { "KRNL", "PARM" };
data/rkflashtool-0~20160324/rkcrc.c:46: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 *const strings[2] = { "info", "fatal" };
data/rkflashtool-0~20160324/rkcrc.c:84: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).
    if ((in = open(argv[0], O_BINARY | O_RDONLY)) == -1)
data/rkflashtool-0~20160324/rkcrc.c:90: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).
    if ((out = open(argv[1], O_BINARY | O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1)
data/rkflashtool-0~20160324/rkcrc.c:94: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(buf, headers[which], 4);
data/rkflashtool-0~20160324/rkflashtool.c:102: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.
    const char name[8];
data/rkflashtool-0~20160324/rkflashtool.c:142:51:  [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.
#define MAX_NAND_ID (sizeof manufacturer / sizeof(char *))
data/rkflashtool-0~20160324/rkflashtool.c:150: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 *const strings[2] = { "info", "fatal" };
data/rkflashtool-0~20160324/rkflashtool.c:194: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(cmd, "USBC", 4);
data/rkflashtool-0~20160324/rkflashtool.c:208: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(cmd, "USBC", 4);
data/rkflashtool-0~20160324/rkflashtool.c:221: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(cmd, "USBC", 4);
data/rkflashtool-0~20160324/rkflashtool.c:402: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 partexp[256];
data/rkflashtool-0~20160324/rkunpack.c:56: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 *const strings[2] = { "info", "fatal" };
data/rkflashtool-0~20160324/rkunpack.c:74: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).
    if ((img = open(path, O_BINARY | O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1 ||
data/rkflashtool-0~20160324/rkunpack.c:83: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 dir[PATH_MAX];
data/rkflashtool-0~20160324/rkunpack.c:123:17:  [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(dir, path, sep - path);
data/rkflashtool-0~20160324/rkunpack.c:180: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).
    if ((fd = open(argv[1], O_BINARY | O_RDONLY)) == -1)
data/rkflashtool-0~20160324/rkcrc.c:100:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    while ((nr = read(in, buf, sizeof(buf))) > 0) {
data/rkflashtool-0~20160324/rkflashtool.c:344:22:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        while ((nr = read(0, buf, 4096)) == 4096) {
data/rkflashtool-0~20160324/rkflashtool.c:358:22:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        while ((nr = read(0, buf, 4096)) == 4096) {
data/rkflashtool-0~20160324/rkflashtool.c:375:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(20*1000);
data/rkflashtool-0~20160324/rkflashtool.c:492:17:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            if (read(0, buf, RKFT_BLOCKSIZE) <= 0) {
data/rkflashtool-0~20160324/rkflashtool.c:537:13:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
            strncpy((char *)buf, "PARM", 4);
data/rkflashtool-0~20160324/rkflashtool.c:541:29:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            if ((sizeRead = read(0, buf + 8, RKFT_BLOCKSIZE - 8)) < 0) {
data/rkflashtool-0~20160324/rkflashtool.c:588:29:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            if ((sizeRead = read(0, buf, RKFT_BLOCKSIZE)) <= 0) {
data/rkflashtool-0~20160324/rkflashtool.c:630:17:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            if (read(0, ibuf, RKFT_IDB_DATASIZE) <= 0) {

ANALYSIS SUMMARY:

Hits = 33
Lines analyzed = 1283 in approximately 0.05 seconds (27559 lines/second)
Physical Source Lines of Code (SLOC) = 964
Hits@level = [0]  15 [1]   9 [2]  17 [3]   4 [4]   3 [5]   0
Hits@level+ = [0+]  48 [1+]  33 [2+]  24 [3+]   7 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 49.7925 [1+] 34.2324 [2+] 24.8963 [3+] 7.26141 [4+] 3.11203 [5+]   0
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.