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/memlockd-1.2/memlockd.cpp

FINAL RESULTS:

data/memlockd-1.2/memlockd.cpp:53:5:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    vfprintf(stderr, format, argp);
data/memlockd-1.2/memlockd.cpp:122:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(newname + offset, "%s%s", archname, tmp + 5);
data/memlockd-1.2/memlockd.cpp:235:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(buf, "/usr/bin/ldd %s", name);
data/memlockd-1.2/memlockd.cpp:240:5:  [4] (shell) execv:
  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.
    execv(argv[0], (char * const *)argv);
data/memlockd-1.2/memlockd.cpp:390:20:  [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(-1 != (c = getopt(argc, argv, "fdc:u:")) )
data/memlockd-1.2/memlockd.cpp:98: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(&new_files[num_new_files].sb, sb, sizeof(struct stat));
data/memlockd-1.2/memlockd.cpp:121: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(newname, orig_name, offset);
data/memlockd-1.2/memlockd.cpp:137: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).
  int fd = open(name, O_RDONLY);
data/memlockd-1.2/memlockd.cpp:161: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(&new_files[num_new_files], &files[i], sizeof(FILE_DATA));
data/memlockd-1.2/memlockd.cpp:169: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(&new_files[num_new_files], &files[i], sizeof(FILE_DATA));
data/memlockd-1.2/memlockd.cpp:221: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 buf[4096];
data/memlockd-1.2/memlockd.cpp:236: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 *argv[3];
data/memlockd-1.2/memlockd.cpp:249: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 buf[4096];
data/memlockd-1.2/memlockd.cpp:295: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 buf[1024];
data/memlockd-1.2/memlockd.cpp:310: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).
  FILE *fp = fopen(config_name, "r");
data/memlockd-1.2/memlockd.cpp:311: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 buf[BUF_SIZE];
data/memlockd-1.2/memlockd.cpp:373: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(files, new_files, sizeof(FILE_DATA) * num_new_files);
data/memlockd-1.2/memlockd.cpp:433:16:  [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 *fp = fopen(PIDFILE, "r");
data/memlockd-1.2/memlockd.cpp:434: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 buf[20];
data/memlockd-1.2/memlockd.cpp:438:19:  [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).
        old_pid = atoi(buf);
data/memlockd-1.2/memlockd.cpp:469:16:  [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 *fp = fopen(PIDFILE, "w");
data/memlockd-1.2/memlockd.cpp:115:34:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  char *newname = (char *)malloc(strlen(orig_name) + 1 + strlen(archname));
data/memlockd-1.2/memlockd.cpp:115:58:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  char *newname = (char *)malloc(strlen(orig_name) + 1 + strlen(archname));
data/memlockd-1.2/memlockd.cpp:292:17:  [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(entry->d_name);
data/memlockd-1.2/memlockd.cpp:314: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).
    int len = strlen(buf) - 1;

ANALYSIS SUMMARY:

Hits = 25
Lines analyzed = 487 in approximately 0.02 seconds (24367 lines/second)
Physical Source Lines of Code (SLOC) = 451
Hits@level = [0]   4 [1]   4 [2]  16 [3]   1 [4]   4 [5]   0
Hits@level+ = [0+]  29 [1+]  25 [2+]  21 [3+]   5 [4+]   4 [5+]   0
Hits/KSLOC@level+ = [0+] 64.3016 [1+] 55.4324 [2+] 46.5632 [3+] 11.0865 [4+] 8.86918 [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.