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/keynav-0.20180421~git6505bd0d/keynav.c

FINAL RESULTS:

data/keynav-0.20180421~git6505bd0d/keynav.c:963:11:  [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.
    ret = execvp(shell, argv);
data/keynav-0.20180421~git6505bd0d/keynav.c:1792:3:  [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(g_argv[0], g_argv);
data/keynav-0.20180421~git6505bd0d/keynav.c:377:46:  [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.
        asprintf(&newrecordingpath, "%s/%s", getenv("HOME"), path + 2);
data/keynav-0.20180421~git6505bd0d/keynav.c:406:27:  [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 *homedir = getenv("HOME");
data/keynav-0.20180421~git6505bd0d/keynav.c:1889:20:  [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.
  if ((pcDisplay = getenv("DISPLAY")) == NULL) {
data/keynav-0.20180421~git6505bd0d/keynav.c:127: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 drag_modkeys[128];
data/keynav-0.20180421~git6505bd0d/keynav.c:402: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 line[LINEBUF_SIZE];
data/keynav-0.20180421~git6505bd0d/keynav.c:423:8:  [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(file, "r");
data/keynav-0.20180421~git6505bd0d/keynav.c:744: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 label[3] = "AA";
data/keynav-0.20180421~git6505bd0d/keynav.c:960: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 *const argv[4] = { shell, "-c", args, NULL };
data/keynav-0.20180421~git6505bd0d/keynav.c:1101:12:  [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).
  button = atoi(args);
data/keynav-0.20180421~git6505bd0d/keynav.c:1188:29:  [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).
    grid_cols = grid_rows = atoi(args);
data/keynav-0.20180421~git6505bd0d/keynav.c:1209:9:  [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).
    z = atoi(args);
data/keynav-0.20180421~git6505bd0d/keynav.c:1637: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(&(wininfo_history[i - 1]),
data/keynav-0.20180421~git6505bd0d/keynav.c:1644: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(&(wininfo_history[wininfo_history_cursor]),
data/keynav-0.20180421~git6505bd0d/keynav.c:1799: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).
  output = fopen(filename, "w");
data/keynav-0.20180421~git6505bd0d/keynav.c:1825: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(filename, "r");
data/keynav-0.20180421~git6505bd0d/keynav.c:1830: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 line[bufsize];
data/keynav-0.20180421~git6505bd0d/keynav.c:1838:15:  [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).
    keycode = atoi(line);
data/keynav-0.20180421~git6505bd0d/keynav.c:435: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).
    *(line + strlen(line) - 1) = '\0';
data/keynav-0.20180421~git6505bd0d/keynav.c:855: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(10000); /* sleep for 10ms */
data/keynav-0.20180421~git6505bd0d/keynav.c:944: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).
    *(args + strlen(args) - 1) = '\0';
data/keynav-0.20180421~git6505bd0d/keynav.c:954: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).
    *(args + strlen(args) - 1) = '\0';
data/keynav-0.20180421~git6505bd0d/keynav.c:1123:17:  [1] (buffer) sscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
    int count = sscanf(args, "%d %127s", &button, drag_modkeys);
data/keynav-0.20180421~git6505bd0d/keynav.c:1531:9:  [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(key) == 1 && isalpha(*key))) {
data/keynav-0.20180421~git6505bd0d/keynav.c:1834: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).
    *(line + strlen(line) - 1) = '\0';

ANALYSIS SUMMARY:

Hits = 26
Lines analyzed = 1985 in approximately 0.16 seconds (12557 lines/second)
Physical Source Lines of Code (SLOC) = 1509
Hits@level = [0]  35 [1]   7 [2]  14 [3]   3 [4]   2 [5]   0
Hits@level+ = [0+]  61 [1+]  26 [2+]  19 [3+]   5 [4+]   2 [5+]   0
Hits/KSLOC@level+ = [0+] 40.4241 [1+] 17.23 [2+] 12.5911 [3+] 3.31345 [4+] 1.32538 [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.