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/abootimg-0.6/abootimg.c
Examining data/abootimg-0.6/bootimg.h

FINAL RESULTS:

data/abootimg-0.6/abootimg.c:104:3:  [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, fmt, args);
data/abootimg-0.6/abootimg.c:242:11:  [4] (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).
          strcat(config_args, argv[i]);
data/abootimg-0.6/abootimg.c:424: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(img->header.cmdline, value);
data/abootimg-0.6/abootimg.c:90:1:  [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 config_args[MAX_CONF_LEN] = "";
data/abootimg-0.6/abootimg.c:333: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).
    int fd = open(img->fname, O_RDONLY);
data/abootimg-0.6/abootimg.c:351:17:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  img->stream = fopen(img->fname, mode);
data/abootimg-0.6/abootimg.c:462:25:  [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* config_file = fopen(img->config_fname, "r");
data/abootimg-0.6/abootimg.c:524:20:  [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* stream = fopen(img->kernel_fname, "r");
data/abootimg-0.6/abootimg.c:546:20:  [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* stream = fopen(img->ramdisk_fname, "r");
data/abootimg-0.6/abootimg.c:582:20:  [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* stream = fopen(img->second_fname, "r");
data/abootimg-0.6/abootimg.c:746:23:  [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* config_file = fopen(img->config_fname, "w");
data/abootimg-0.6/abootimg.c:784:23:  [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* kernel_file = fopen(img->kernel_fname, "w");
data/abootimg-0.6/abootimg.c:820:24:  [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* ramdisk_file = fopen(img->ramdisk_fname, "w");
data/abootimg-0.6/abootimg.c:860:23:  [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* second_file = fopen(img->second_fname, "w");
data/abootimg-0.6/abootimg.c:887: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(img->header.magic, BOOT_MAGIC, BOOT_MAGIC_SIZE);
data/abootimg-0.6/bootimg.h:30: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 magic[BOOT_MAGIC_SIZE];
data/abootimg-0.6/bootimg.h:45: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 name[BOOT_NAME_SIZE]; /* asciiz product name */
data/abootimg-0.6/bootimg.h:47: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 cmdline[BOOT_ARGS_SIZE];
data/abootimg-0.6/bootimg.h: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 name[16];      /* asciiz partition name    */
data/abootimg-0.6/abootimg.c:239: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).
          unsigned len = strlen(argv[i]);
data/abootimg-0.6/abootimg.c:240:15:  [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 (strlen(config_args)+len+1 >= MAX_CONF_LEN)
data/abootimg-0.6/abootimg.c:243:11:  [1] (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 character.
          strcat(config_args, "\n");
data/abootimg-0.6/abootimg.c:420: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).
    unsigned len = strlen(value);
data/abootimg-0.6/abootimg.c:427:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(img->header.name, value, BOOT_NAME_SIZE);
data/abootimg-0.6/abootimg.c:470:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    int read;
data/abootimg-0.6/abootimg.c:481: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).
  unsigned len = strlen(config_args);
data/abootimg-0.6/abootimg.c:491:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    int read;

ANALYSIS SUMMARY:

Hits = 27
Lines analyzed = 1047 in approximately 0.04 seconds (29655 lines/second)
Physical Source Lines of Code (SLOC) = 775
Hits@level = [0]  54 [1]   8 [2]  16 [3]   0 [4]   3 [5]   0
Hits@level+ = [0+]  81 [1+]  27 [2+]  19 [3+]   3 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 104.516 [1+] 34.8387 [2+] 24.5161 [3+] 3.87097 [4+] 3.87097 [5+]   0
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.